Commit 1c725847 authored by Yaowentong's avatar Yaowentong

修改模型为豆包2.0 mini

parent c4ef5508
......@@ -1185,50 +1185,67 @@ if __name__ == "__main__":
# req_list.append(i.get('req_id'))
# print(req_list)
# qian_report(15100000026,'2026-06-21','2026-06-21','oral')
data_list = bh_utils.query_data(
f"select * from geo_commit_task where platform in ('TYQWA','DOUBA') and insertime >1780243200")
def handle_item(i):
try:
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'))
taskId = i.get('taskId')
reqId = i.get('reqId')
platform = i.get('platform')
content_file_path = f'geo/{taskId}/{platform}/context.txt'
result_file_path = f'geo/{taskId}/{platform}/result.json'
content = tos_utils.get_string_from_tos(content_file_path)
if 'render_ecom_card_widget_' not in content:
return
logger.success(f"{reqId}----{platform}更新完成")
result_content = tos_utils.get_string_from_tos(result_file_path)
result_content_json = json.loads(result_content)
result_content_json["hasGoods"] = 1
tos_utils.put_string_to_tos(result_file_path, result_content_json)
if platform == 'TYQWA':
return qianwen_android_process_original_data(i)
elif platform == 'DOUBA':
return doubao_mobile_process_original_data(i)
except Exception as e:
print(f"{i.get('taskId')} error: {e}")
if data_list:
with ThreadPoolExecutor(max_workers=50) as executor:
list(executor.map(handle_item, data_list))
phone = 18521518364
begin = '2026-04-15'
end = '2026-07-13'
req_list = get_req_id(phone, begin, end)
brand_name1 = '王康医生'
brand_name2 = '殷敏毅'
req_list_result1 = []
req_list_result2 = []
for i in req_list :
if i.get('brand_name') == brand_name1:
req_list_result1.append(i.get('req_id'))
if i.get('brand_name') == brand_name2:
req_list_result2.append(i.get('req_id'))
print(f"req_list_result1:{len(req_list_result1)}")
print(req_list_result1)
print(f"req_list_result2:{len(req_list_result2)}")
print(req_list_result2)
# data_list = bh_utils.query_data(
# f"select * from geo_commit_task where platform in ('TYQWA','DOUBA') and insertime >1780243200")
#
#
# def handle_item(i):
# try:
# 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'))
#
# taskId = i.get('taskId')
# reqId = i.get('reqId')
# platform = i.get('platform')
# content_file_path = f'geo/{taskId}/{platform}/context.txt'
# result_file_path = f'geo/{taskId}/{platform}/result.json'
#
# content = tos_utils.get_string_from_tos(content_file_path)
#
# if 'render_ecom_card_widget_' not in content:
# return
# logger.success(f"{reqId}----{platform}更新完成")
# result_content = tos_utils.get_string_from_tos(result_file_path)
# result_content_json = json.loads(result_content)
# result_content_json["hasGoods"] = 1
#
# tos_utils.put_string_to_tos(result_file_path, result_content_json)
#
# if platform == 'TYQWA':
# return qianwen_android_process_original_data(i)
#
# elif platform == 'DOUBA':
# return doubao_mobile_process_original_data(i)
# except Exception as e:
# print(f"{i.get('taskId')} error: {e}")
#
#
# if data_list:
# with ThreadPoolExecutor(max_workers=50) as executor:
# list(executor.map(handle_item, data_list))
......@@ -1994,10 +1994,10 @@ def run_data(PAGE_SIZE,MAX_WORKERS):
if __name__ == '__main__':
#
data_list = bh_utils.query_data(f"select * from geo_commit_task where status='ING'")
data_list = bh_utils.query_data(f"select * from geo_commit_task where status ='ING' and type !='stream' and platform = 'TXYB'")
def handle_item(i):
if i.get('comWordsMap'):
i['comWordsMap'] = json.loads(i.get('comWordsMap'))
if i.get('brandWords'):
......@@ -2009,13 +2009,12 @@ if __name__ == '__main__':
if i.get('productWordsMap'):
i['productWordsMap'] = json.loads(i.get('productWordsMap'))
type_t = i.get('type')
type_t = 'batch'
# commit_task(i,'ING')
return task_send_queue(i,type_t)
# return platform_process(i)
# return task_send_queue(i,type_t)
return platform_process(i)
#
if data_list:
with ThreadPoolExecutor(max_workers=30) as executor:
with ThreadPoolExecutor(max_workers=50) as executor:
futures = [executor.submit(handle_item, i) for i in data_list]
for future in as_completed(futures):
......
import json
import re
from aidso_geo.models import spider_save_tos
from aidso_geo.models.eco_data_process import save_eco_data_to_bh
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
def process_price(ori_price):
price_match = re.search(
......@@ -175,7 +178,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 = '2a7fca28-5389-4506-ad2a-76c222fe424e' and platform = 'TXYBA'")
f"select * from geo_commit_task where taskId = '4ae7a6f3-c2a4-4804-9dc2-8f2385674c60' and platform = 'TXYBA'")
# # #
......
......@@ -12,7 +12,7 @@ from aidso_geo.utils.tos_utils import get_string_from_tos
def ai_get_brand_list(content, prompt):
url = "https://ark.cn-beijing.volces.com/api/v3/chat/completions"
payload = json.dumps({
"model": "doubao-seed-1-6-250615",
"model": "doubao-seed-2-0-mini-260428",
"messages": [
{
"role": "system",
......@@ -74,7 +74,7 @@ def ai_get_brand_list(content, prompt):
def ai_get_product_list(content, prompt):
url = "https://ark.cn-beijing.volces.com/api/v3/chat/completions"
payload = json.dumps({
"model": "doubao-seed-2-0-lite-260215",
"model": "doubao-seed-2-0-mini-260428",
"messages": [
{
"role": "system",
......@@ -144,7 +144,7 @@ def ai_get_product_list(content, prompt):
def ai_get_product_list_search(product_list):
url = "https://ark.cn-beijing.volces.com/api/v3/chat/completions"
payload = json.dumps({
"model": "doubao-seed-1-6-250615",
"model": "doubao-seed-2-0-mini-260428",
"messages": [
{
"role": "system",
......@@ -211,7 +211,7 @@ def ai_get_brand_name(content):
# 修正JSON Schema定义:array类型需配置items,同时调整最终期望返回字典格式的提示
payload = json.dumps({
"model": "doubao-seed-1-6-250615",
"model": "doubao-seed-2-0-mini-260428",
"messages": [
{
"role": "system",
......@@ -323,23 +323,7 @@ def ai_get_brand_name(content):
return brand_emotion_dict
def ai_get_product_sentiment_and_mentions(brand_list, ai_answer_text):
"""
入参:
- brand_list: list[str] 品牌列表(顺序很重要)
- ai_answer_text: str AI回答文本
返回:
list[dict],格式:
[
{
"brand_name": "...",
"sentiment": "正向|负向|中性",
"positive_mentions": [...],
"negative_mentions": [...]
},
...
]
"""
url = "https://ark.cn-beijing.volces.com/api/v3/chat/completions"
......@@ -367,7 +351,7 @@ def ai_get_product_sentiment_and_mentions(brand_list, ai_answer_text):
""".strip()
payload = {
"model": "doubao-seed-1-6-250615",
"model": "doubao-seed-2-0-mini-260428",
"messages": [
{"role": "system", "content": system_prompt},
{
......@@ -455,23 +439,7 @@ def ai_get_product_sentiment_and_mentions(brand_list, ai_answer_text):
return _fallback_items(brand_list)
def ai_get_brand_sentiment_and_mentions(brand_list, ai_answer_text):
"""
入参:
- brand_list: list[str] 品牌列表(顺序很重要)
- ai_answer_text: str AI回答文本
返回:
list[dict],格式:
[
{
"brand_name": "...",
"sentiment": "正向|负向|中性",
"positive_mentions": [...],
"negative_mentions": [...]
},
...
]
"""
url = "https://ark.cn-beijing.volces.com/api/v3/chat/completions"
......@@ -499,7 +467,7 @@ def ai_get_brand_sentiment_and_mentions(brand_list, ai_answer_text):
""".strip()
payload = {
"model": "doubao-seed-1-6-250615",
"model": "doubao-seed-2-0-mini-260428",
"messages": [
{"role": "system", "content": system_prompt},
{
......@@ -594,7 +562,7 @@ def _fallback_items(brand_list):
def ai_get_product_and_brands(content, prompt):
url = "https://ark.cn-beijing.volces.com/api/v3/chat/completions"
payload = json.dumps({
"model": "doubao-seed-1-6-250615",
"model": "doubao-seed-2-0-mini-260428",
"messages": [
{
"role": "system",
......@@ -708,35 +676,7 @@ def ai_get_product_and_brands(content, prompt):
def ai_get_brand_sentiment_and_mentions_by_articles(brand_name, article_list, batch_size=50):
"""
入参:
- brand_name: str
单个品牌名,例如: "珂润"
- article_list: list[dict]
文章列表,例如:
[
{"sourceId": "1001", "snippet": "文章内容1..."},
{"sourceId": "1002", "snippet": "文章内容2..."},
...
]
- batch_size: int
每批送给模型的文章数,默认 20
返回:
list[dict],格式:
[
{
"sourceId": "1001",
"brand_name": "珂润",
"sentiment": "正向|负向|中性",
"positive_mentions": [...],
"negative_mentions": [...]
},
...
]
"""
normalized_articles = []
for item in article_list or []:
......@@ -836,7 +776,7 @@ def _call_single_batch(brand_name, batch_articles):
]
payload = {
"model": "doubao-seed-1-6-250615",
"model": "doubao-seed-2-0-mini-260428",
"messages": [
{"role": "system", "content": system_prompt},
{
......@@ -996,15 +936,16 @@ if __name__ == '__main__':
* **要本地味** → 可以试试**金永丰**,但要注意渠道和日期。
* **要最方便** → 去**大润发、家乐福**等大型超市,选择多,品质稳。
"""
brand_list =['六必居'
'大润发',
'家乐福',
'崔字牌',
'海南金永丰',
'金永丰',
brand_list =[
"瓜子二手车","二手车之家"
# fcc424e5-58af-494d-9683-5787413a26c9
]
print(ai_get_brand_list(brand_list,content))
ai_response = """
5万左右二手车购买平台推荐
"""
print(ai_get_brand_sentiment_and_mentions(brand_list,ai_response))
# print(ai_result)
# pro =
# ai_get_product_list()
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