Update app.py
Browse files
app.py
CHANGED
@@ -49,15 +49,15 @@ if url !="" and not url.strip().isspace() and not url == "" and not url.strip()
|
|
49 |
print("Website to Chat: "+url)
|
50 |
loader = WebBaseLoader(url)
|
51 |
docs = loader.load()
|
|
|
52 |
#split_docs = text_splitter_rcs.split_documents(docs)
|
53 |
-
#print(split_docs)
|
54 |
-
print()
|
55 |
result=chain.run(docs) #这个result的格式比较特殊,可以直接print,但不可以和其他字符串联合print输出 - this step errors!
|
56 |
#result=chain.run(split_docs) #找到之前总是POST Error的原因:chain.run(docs)的结果,格式不是str,导致程序错误
|
|
|
57 |
result=str(result)
|
58 |
cleaned_initial_ai_response = remove_context(result)
|
59 |
-
print(cleaned_initial_ai_response)
|
60 |
-
print()
|
61 |
final_ai_response = cleaned_initial_ai_response.split('<|end|>')[0].strip().replace('\n\n', '\n').replace('<|end|>', '').replace('<|user|>', '').replace('<|system|>', '').replace('<|assistant|>', '')
|
62 |
new_final_ai_response = final_ai_response.split('Unhelpful Answer:')[0].strip()
|
63 |
final_result = new_final_ai_response.split('Note:')[0].strip()
|
|
|
49 |
print("Website to Chat: "+url)
|
50 |
loader = WebBaseLoader(url)
|
51 |
docs = loader.load()
|
52 |
+
print("Webpage contents loaded")
|
53 |
#split_docs = text_splitter_rcs.split_documents(docs)
|
54 |
+
#print(split_docs)
|
|
|
55 |
result=chain.run(docs) #这个result的格式比较特殊,可以直接print,但不可以和其他字符串联合print输出 - this step errors!
|
56 |
#result=chain.run(split_docs) #找到之前总是POST Error的原因:chain.run(docs)的结果,格式不是str,导致程序错误
|
57 |
+
print("Chain run finished")
|
58 |
result=str(result)
|
59 |
cleaned_initial_ai_response = remove_context(result)
|
60 |
+
print("Ai Resposne result cleaned initially: "+cleaned_initial_ai_response)
|
|
|
61 |
final_ai_response = cleaned_initial_ai_response.split('<|end|>')[0].strip().replace('\n\n', '\n').replace('<|end|>', '').replace('<|user|>', '').replace('<|system|>', '').replace('<|assistant|>', '')
|
62 |
new_final_ai_response = final_ai_response.split('Unhelpful Answer:')[0].strip()
|
63 |
final_result = new_final_ai_response.split('Note:')[0].strip()
|