OuroborosM commited on
Commit
e0a4089
·
1 Parent(s): d637099

remove new func

Browse files
Files changed (1) hide show
  1. app.py +1 -44
app.py CHANGED
@@ -113,7 +113,7 @@ class GPTRemote(LLM):
113
  GPTfake = GPTRemote(n=0)
114
 
115
 
116
- async def start_playwright_old(question: str):
117
  pw = await async_playwright().start()
118
  browser = await pw.chromium.launch(headless=True)
119
  # browser = await pw.webkit.launch(headless=True)
@@ -150,50 +150,7 @@ async def start_playwright_old(question: str):
150
  print("-------- Final Answer-----------\n", output_text)
151
  await browser.close()
152
 
153
- async def init_playwright():
154
- pw = await async_playwright().start()
155
- browser = await pw.chromium.launch(headless=True)
156
- page = await browser.new_page()
157
- await page.goto("https://basicchatbot.azurewebsites.net/")
158
- return page
159
- page = asyncio.run(init_playwright())
160
 
161
- async def start_playwright(question: str):
162
- # pw = await async_playwright().start()
163
- # browser = await pw.chromium.launch(headless=True)
164
- # # browser = await pw.webkit.launch(headless=True)
165
- # page = await browser.new_page()
166
-
167
- # # note all methods are async (use the "await" keyword)
168
- # await page.goto("https://basicchatbot.azurewebsites.net/")
169
- # # print("Title of Web: ", await page.title())
170
- # await page.wait_for_timeout(200)
171
- # print("Content of Web: ", await page.content())
172
- # print("Test content: ", await page.locator("//div[@class='css-zt5igj e1nzilvr3']").inner_html())
173
- # print("Test content: ", await page.locator("//div[@class='css-zt5igj e1nzilvr3']").inner_text())
174
-
175
- await page.locator("//textarea").fill(question)
176
- await page.wait_for_timeout(200)
177
- # print("Content of Web: ", await page.content())
178
- # await page.locator("//button[@class='css-1wi2cd3 e1d2x3se3']").click()
179
- await page.locator("//textarea").press("Enter")
180
- await page.wait_for_timeout(2000)
181
- # print("Content of Web: ", await page.content())
182
- # print("output_text 1", await page.locator("//div[@aria-label='Chat message from assistant']").last.inner_text())
183
- # output_text = await page.locator("//div[@aria-label='Chat message from assistant']").last.inner_text()
184
- # print("output_text 1", output_text)
185
- output_history = "NOTHING"
186
- for i in range(40):
187
- output_text = await page.locator("//div[@aria-label='Chat message from assistant']").last.inner_text()
188
- print("output_text... :")
189
-
190
- if output_text == output_history and '▌' not in output_text and output_text != "":
191
- return output_text
192
- else:
193
- await page.wait_for_timeout(500)
194
- output_history = output_text
195
- print("-------- Final Answer-----------\n", output_text)
196
- # await browser.close()
197
 
198
  # import playsound
199
 
 
113
  GPTfake = GPTRemote(n=0)
114
 
115
 
116
+ async def start_playwright(question: str):
117
  pw = await async_playwright().start()
118
  browser = await pw.chromium.launch(headless=True)
119
  # browser = await pw.webkit.launch(headless=True)
 
150
  print("-------- Final Answer-----------\n", output_text)
151
  await browser.close()
152
 
 
 
 
 
 
 
 
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
  # import playsound
156