Skip to content

Commit dd36a8a

Browse files
committed
Adds UI and improves summaries and ground truth checking.
1 parent cbd6792 commit dd36a8a

File tree

9 files changed

+351
-2314
lines changed

9 files changed

+351
-2314
lines changed

app.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@ async def get_urls_to_browse(request_body, request_headers, searches):
510510
return URLsToBrowse
511511

512512
async def fetch_and_parse_url(url):
513-
set_status_message("Browsing...")
514513
response = requests.get(url)
515514
if response.status_code == 200: # Raise an error for bad status codes
516515
# Parse the web page
@@ -526,20 +525,29 @@ async def fetch_and_parse_url(url):
526525
async def get_article_summaries(request_body, request_headers, URLsToBrowse):
527526
Summaries = None
528527
URLsToBrowse = json.loads(URLsToBrowse)
528+
Pages = None
529+
530+
set_status_message("Browsing...")
529531
for URL in URLsToBrowse:
530532
page_content = await fetch_and_parse_url(URL)
531-
if page_content != None:
532-
system_prompt = "You are tasked with helping content developers resolve customer feedback on their content on learn.microsoft.com. Right now, you've identified the following URL for further research: " + URL + ". Your task now is to provide a summary of relevant content on the page that will help us address the feedback on the URL provided by the user and document current sources. Return nothing except your summary of the key points and any important quotes the content on the page in a single string.\n\nPage Content:\n\n" + page_content + "\n\nOriginal System Message:\n\n"
533-
534-
set_status_message("Analyzing...")
535-
summary = await send_private_chat(request_body, request_headers, None, system_prompt)
533+
if Pages is None:
534+
Pages = [page_content]
535+
else:
536+
Pages.append(page_content)
537+
538+
set_status_message("Analyzing...")
539+
currentPage = 0
540+
for URL in URLsToBrowse:
541+
if Pages[currentPage] != None:
542+
system_prompt = "You are tasked with helping content developers resolve customer feedback on their content on learn.microsoft.com. Right now, you've identified the following URL for further research: " + URL + ". Your task now is to provide a summary of relevant content on the page that will help us address the feedback on the URL provided by the user and document current sources. Return nothing except your summary of the key points and any important quotes the content on the page in a single string.\n\nPage Content:\n\n" + Pages[currentPage] + "\n\nOriginal System Message:\n\n"
543+
summary = await send_private_chat(request_body, request_headers, None, system_prompt) # Get summary of page content
536544
summary = json.loads("{\"URL\" : \"" + URL + "\",\n\"summary\" : " + json.dumps(summary) + "}")
537-
538545
if Summaries is None:
539546
Summaries = [summary]
540547
else:
541548
Summaries.append(summary)
542-
return Summaries
549+
550+
return Summaries
543551

544552
async def is_background_info_sufficient(request_body, request_headers, Summaries):
545553
strSummaries = json.dumps(Summaries, indent=4)
@@ -561,11 +569,10 @@ async def search_and_add_background_references(request_body, request_headers):
561569
else:
562570
searches = await identify_searches(request_body, request_headers, Summaries)
563571

564-
print(f"Searches: {searches}")
565572
if searches == None:
566573
return None
567574

568-
set_status_message("Gathering search results...")
575+
set_status_message("Browsing...")
569576
URLsToBrowse = await get_urls_to_browse(request_body, request_headers, searches)
570577
if URLsToBrowse == "Search error.":
571578
return "Search error."

frontend/dist/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)