Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -365,7 +365,7 @@ async def trade_setup():
|
|
365 |
|
366 |
|
367 |
@time_logger
|
368 |
-
async def get_google_news(queries, max_results
|
369 |
try:
|
370 |
results=[] ## checking
|
371 |
task = []
|
@@ -392,7 +392,7 @@ async def get_google_news(queries, max_results=3):
|
|
392 |
async def get_duckai_news(queries):
|
393 |
|
394 |
task = []
|
395 |
-
results = await get_google_news(queries, 3)
|
396 |
prompt = """#Instruction:
|
397 |
Summarise the impactful points of the news and mention the news link and date of publish at the end if available
|
398 |
#Format:
|
@@ -445,7 +445,7 @@ async def raw_news(raw_query, subqueries, todays_news_func_call, ticker):
|
|
445 |
swot_analysis_link = f'https://widgets.trendlyne.com/web-widget/swot-widget/Poppins/{urllib.parse.quote(ticker)}/'
|
446 |
tasks = [get_the_ticker_stat(ticker),
|
447 |
get_the_ticker_news(ticker),
|
448 |
-
get_google_news(subqueries,10),
|
449 |
scrape_webpage(swot_analysis_link)]
|
450 |
try:
|
451 |
ticker_stats, ticker_news, google_news, swot_analysis = await asyncio.gather(*tasks)
|
@@ -556,7 +556,7 @@ def generate_final_response(prompt, history):
|
|
556 |
news_link.append(asyncio.run(get_duckai_news(subqueries)))
|
557 |
elif chat_completion_params['todays_news_flag'] and len(ticker)>0:
|
558 |
for tick in chat_completion_params["stock_name"]:
|
559 |
-
news_googles.append(f"Latest News for {tick}\n\n {asyncio.run(get_google_news(subqueries,10))}")
|
560 |
elif (chat_completion_params['follow_up_query'] and ticker_stats != []) or (display_ticker == ticker and ticker_stats != []):
|
561 |
# logging.info("\n\nAssigned into a followup query\n\n")
|
562 |
chat_completion_params['follow_up_query'] = True
|
|
|
365 |
|
366 |
|
367 |
@time_logger
|
368 |
+
async def get_google_news(queries, max_results):
|
369 |
try:
|
370 |
results=[] ## checking
|
371 |
task = []
|
|
|
392 |
async def get_duckai_news(queries):
|
393 |
|
394 |
task = []
|
395 |
+
results = await get_google_news(queries, int(3))
|
396 |
prompt = """#Instruction:
|
397 |
Summarise the impactful points of the news and mention the news link and date of publish at the end if available
|
398 |
#Format:
|
|
|
445 |
swot_analysis_link = f'https://widgets.trendlyne.com/web-widget/swot-widget/Poppins/{urllib.parse.quote(ticker)}/'
|
446 |
tasks = [get_the_ticker_stat(ticker),
|
447 |
get_the_ticker_news(ticker),
|
448 |
+
get_google_news(subqueries, int(10)),
|
449 |
scrape_webpage(swot_analysis_link)]
|
450 |
try:
|
451 |
ticker_stats, ticker_news, google_news, swot_analysis = await asyncio.gather(*tasks)
|
|
|
556 |
news_link.append(asyncio.run(get_duckai_news(subqueries)))
|
557 |
elif chat_completion_params['todays_news_flag'] and len(ticker)>0:
|
558 |
for tick in chat_completion_params["stock_name"]:
|
559 |
+
news_googles.append(f"Latest News for {tick}\n\n {asyncio.run(get_google_news(subqueries, int(10)))}")
|
560 |
elif (chat_completion_params['follow_up_query'] and ticker_stats != []) or (display_ticker == ticker and ticker_stats != []):
|
561 |
# logging.info("\n\nAssigned into a followup query\n\n")
|
562 |
chat_completion_params['follow_up_query'] = True
|