Commit e8139ef6 authored by Yaowentong's avatar Yaowentong

元宝修复 app 网页 对话内容修复

parent f0360ce3
......@@ -31,21 +31,22 @@ def yuanbao_android_process_original_data(data):
# 提取并解析JSON数据
data_str = i.split("data: ")[1]
json_data = json.loads(data_str)
except (IndexError, json.JSONDecodeError):
continue # 跳过格式错误的数据
if json_data.get('type') == 'searchGuid':
url_list = json_data.get('docs')
if json_data.get('type') == 'think':
think_content += json_data.get('content')
if json_data.get('type') == 'text' and json_data.get('msg') is not None:
response_content += json_data.get('msg')
response_process += json_data.get('msg')
if json_data.get('type') == 'deepSearch':
if json_data.get('contents'):
if json_data.get('contents')[0].get('msg'):
think_content += json_data.get('contents')[0].get('msg')
if not response_process:
response_content += json_data.get('contents')[0].get('msg')
if json_data.get('contents')[0].get('type') == 'text':
think_content += json_data.get('contents')[0].get('msg')
if json_data.get('contents')[0].get('docs'):
url_list.extend(json_data.get('contents')[0].get('docs'))
if json_data.get('type') == 'image':
......@@ -72,6 +73,7 @@ def yuanbao_android_process_original_data(data):
mini_program_str = json.dumps(mini_program, ensure_ascii=False)
response_content += mini_program_str
response_content += '\n\nrender_ecom_card_widget_miniprogram_end:'
spider_save_tos.process_and_save_files(file_path, search_keyword, url_list, think_content, response_content,
suggestions,rich_media_block)
return (file_path, search_keyword, url_list, think_content, response_content, suggestions)
......@@ -105,7 +107,7 @@ if __name__ == '__main__':
# yuanbao_android_process_original_data(file_path2)
data_list = bh_utils.query_data(f"select * from geo_commit_task where taskId = 'f9018d5c-2d0a-4e6a-9476-4b92334a0715' and platform = 'TXYBA'")
data_list = bh_utils.query_data(f"select * from geo_commit_task where taskId = '539a80f8-cd2d-4ae7-a45c-2b2d41fa738e' and platform = 'TXYBA'")
# # #
# # #
......
import json
from aidso_geo.utils import robot_utils
from aidso_geo.utils import robot_utils, bh_utils
from aidso_geo.utils.ai_interface import get_parse_sse_result
from aidso_geo.utils.tos_utils import get_string_from_tos
......@@ -30,6 +30,7 @@ def yuanbao_process_original_data(data):
# 提取并解析JSON数据
data_str = i.split("data: ")[1]
json_data = json.loads(data_str)
except (IndexError, json.JSONDecodeError):
continue # 跳过格式错误的数据
......@@ -42,9 +43,10 @@ def yuanbao_process_original_data(data):
if json_data.get('type') == 'deepSearch':
if json_data.get('contents'):
if json_data.get('contents')[0].get('msg'):
think_content += json_data.get('contents')[0].get('msg')
if not response_process:
response_content += json_data.get('contents')[0].get('msg')
if json_data.get('contents')[0].get('type') =='text':
think_content += json_data.get('contents')[0].get('msg')
# if not response_process:
# response_content += json_data.get('contents')[0].get('msg')
if json_data.get('type') == 'image':
response_content = "生成了图片"
spider_save_tos.process_and_save_files(file_path, search_keyword, url_list, think_content, response_content,
......@@ -74,7 +76,29 @@ def yuanbao_process_original_data(data):
return (file_path, search_keyword, url_list, think_content, response_content, suggestions)
if __name__ == '__main__':
# https://tcdn.aidso.com/geo/c7581554-435b-47ca-a2e5-d52bea763b8a/DOUBA/search_keyword.txt?secret=11049cbfb1c7018597a2085455505304520f0507080c0c4b514e09
file_path = 'geo/b55be837-48a9-476a-8290-1339ea2ce3f9/TXYB/original.text'
yuanbao_process_original_data(file_path)
data_list = bh_utils.query_data(f"select * from geo_commit_task where taskId = '69189ba0-e443-4e7c-a465-cabc07973540' and platform = 'TXYB'")
# # #
# # #
# # # # #
def handle_item(i):
if i.get('comWordsMap'):
i['comWordsMap'] = json.loads(i.get('comWordsMap'))
if i.get('brandWords'):
i['brandWords'] = json.loads(i.get('brandWords'))
if i.get('comWords'):
i['comWords'] = json.loads(i.get('comWords'))
if i.get('keywords'):
i['keywords'] = json.loads(i.get('keywords'))
if i.get('productWordsMap'):
i['productWordsMap'] = json.loads(i.get('productWordsMap'))
return yuanbao_process_original_data(i)
if data_list:
for i in data_list:
try:
handle_item(i)
except Exception as e:
...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment