Commit b3a35136 authored by Yaowentong's avatar Yaowentong

宝洁品牌映射

电商spuname修复
parent a58e2b76
......@@ -280,7 +280,7 @@ if __name__ == '__main__':
# mt:snipaste_v3:only_content
init_redis_4 = init_redis4()
# print(init_redis_4.delete('mt:snipaste_v3:only_content'))
print(init_redis_4.llen('mt:snipaste_v3:only_content'))
print(init_redis_4.delete('image_video_ocr2'))
# old_count, new_count = deduplicate_redis_list(
# redis_client8,
# "geo:task_commit:list",
......
......@@ -1357,5 +1357,18 @@ def qian_report2(req_ids,plan_name):
# 使用示例
# =========================
if __name__ == "__main__":
req_list = ['05e40120-018e-430d-9fb7-c921bde61920','09b179f5-8de3-4e10-a2f4-576e7e1af661','3716b2e7-41f3-45bb-beb2-1329e6c44670','585e35c9-2783-4706-87f5-469085349a3f','eccc4af3-2320-4fee-a415-2c6d26a6b5e8','0320b50f-ebfc-42d5-9050-01071b5205bd','75f9fc76-c27f-4573-8954-cea9e915b618','72e688fa-2d73-438e-81aa-1460290f6a82','cb18a066-8c88-4821-9d22-9e517332cf05','d8b3a651-abec-450f-8052-72e3d17a3503','b0ffffa2-5900-46ba-a049-ead25a895d96','1cc4a4a1-2923-47bb-b392-f4ffdde112c7','e352fd0e-7f70-4e88-9034-547c39267d61','440b52a2-beba-4c84-9cce-c09c7998d14c','91f485f3-1a3d-4ed5-a733-8197254f3f3a','c8990254-ba68-4790-bea9-ba40bf1c9774','24bf1e91-eb2f-4e4a-96fe-d1d91fda7889','90054909-aa64-444e-b935-d59044f9407d','0e5b86ba-ac03-4179-827f-696ff6fba15f','1ef447ef-aa86-44ec-b4fd-4cd20834edd9','4e09725d-228f-4bd7-9547-b484cbd9efdd','3a6e128e-7c77-4fdf-b0f4-0881fe6dfeee','d0fba64d-c2ab-438a-b5f2-47fb7eaffcd1','49288de5-9cf8-4cfe-8c7f-d81c8909ca35','e50d3df5-395b-4c26-a885-66088ba1c8a5','ed79787c-78be-41df-866d-777b29d0fe67','be59190a-452d-4e58-873b-a65dbfd87945','ad827a32-9c04-4b1f-b314-a4f3520f6cd9','91cb4eed-e8d9-4666-975b-6e079d279c72','19781ed3-fee9-4848-b936-0dc1517682f5','c6b962a9-6851-4238-83c6-4be6fc09d299','38f0eb5b-ed46-4ab9-8d57-3b6f5ebee2a3','55769d35-310f-4d81-8685-dbecd928e14a','cdc316ad-c8bb-407b-8587-e8f01deb306c','821a68df-7f6c-491d-9dc9-5b550e307aaf','dc1ee718-6e8c-4a99-8bda-aaa518523705','0ea1f698-d9fb-4085-9334-f72226566a70']
qian_report2(req_list,'养生酒')
\ No newline at end of file
phone = '15100000026'
begin = '2026-08-05'
end = '2026-08-05'
plan_name = '豆包PC/APP_快速_0805'
req_list = get_req_id(phone, begin, end)
req_ids = []
req_time_map = {}
for item in req_list:
if item.get('plan_name') == plan_name:
req_id = item.get("req_id")
created_at = item.get("created_at")
req_ids.append(req_id)
req_time_map[req_id] = created_at
print(req_ids)
\ No newline at end of file
......@@ -851,15 +851,16 @@ def doubao_process_original_data(file_path, original_content):
except (IndexError, json.JSONDecodeError):
continue
if json_content.get('query_list'):
extra = json_content.get('ack_client_meta').get('conversation_info').get('extra')
if json_content.get('ack_client_meta').get('conversation_info').get('extra'):
extra_json = json.loads(extra)
inner_user_ip = extra_json.get('inner_user_ip')
inner_pc_version = extra_json.get('inner_pc_version')
if inner_user_ip:
tos_utils.put_string_to_tos(f"{file_path_result}/inner_user_ip.txt", inner_user_ip)
if inner_pc_version:
tos_utils.put_string_to_tos(f"{file_path_result}/inner_pc_version.txt", inner_pc_version)
...
# extra = json_content.get('ack_client_meta').get('conversation_info').get('extra')
# if json_content.get('ack_client_meta').get('conversation_info').get('extra'):
# extra_json = json.loads(extra)
# inner_user_ip = extra_json.get('inner_user_ip')
# inner_pc_version = extra_json.get('inner_pc_version')
# if inner_user_ip:
# tos_utils.put_string_to_tos(f"{file_path_result}/inner_user_ip.txt", inner_user_ip)
# if inner_pc_version:
# tos_utils.put_string_to_tos(f"{file_path_result}/inner_pc_version.txt", inner_pc_version)
if json_content.get('event_type') == 2001:
even_data = json.loads(json_content.get('event_data'))
......@@ -936,7 +937,7 @@ def doubao_process_original_data(file_path, original_content):
index = next(
(
item["text_card"]["index"]
for item in url_list
for item in (url_list or [])
if item.get("text_card", {}).get("title") == target_title
),
None
......@@ -3511,7 +3512,7 @@ def run_daily_pipeline_safely(
if __name__ == "__main__":
# platform = "DB"
# try:
# run_daily_pipeline(pt="20260811", platform="DB")
# run_daily_pipeline(pt="20260813", platform="DB")
# except Exception:
# logger.exception(
# f"[每日任务 platform={platform} count=1-99] "
......
This diff is collapsed.
This diff is collapsed.
......@@ -4,6 +4,8 @@ import time
import requests
import json
from loguru import logger
def ai_get_brand_list(content, prompt):
url = "https://ark.cn-beijing.volces.com/api/v3/chat/completions"
......@@ -53,7 +55,8 @@ def ai_get_brand_list(content, prompt):
"thinking": {
"type": "disabled"
},
"temperature": 0
"temperature": 0,
"top_p": 1
})
headers = {
'Authorization': 'Bearer ark-7afc3be2-37a8-47fd-9f02-996258a3d305-27da0',
......@@ -150,23 +153,31 @@ def ai_get_product_relation_spu(product_list, keyword):
"role": "system",
"content": """
你的核心任务为:基于给定的商品列表与查询关键词,为列表内的每一件商品匹配对应信息,最终输出符合规范要求的JSON结果,执行过程需严格遵循以下规则:
1. 需为商品列表中的每一件商品单独生成一条匹配记录,每条记录必须固定包含以下4个字段,各字段的取值规则明确如下:
(1)produce_name:填写对应商品的完整原始名称,即商品列表中给出的该商品全称,不得做任何增删修改;
(2)brand:填写该商品对应的SPU品牌名称,需精准识别商品所属品牌,参考示例:“北京同仁堂陈皮茯苓茶”的品牌取值为“北京同仁堂”,“红魔11 Pro+”的品牌取值为“红魔”;若商品无明确可识别的品牌信息,则直接返回该商品的完整名称作为brand字段值;
(3)spu_name:填写该商品的标准SPU名称,即去除品牌前缀后的商品核心名称,参考示例:“北京同仁堂陈皮茯苓茶”的spu_name取值为“陈皮茯苓茶”,“一加 Ace 6 至尊版”的spu_name取值为“Ace 6 至尊版”;需注意同一款商品的spu_name表述必须完全统一,禁止出现同一SPU存在空格差异、格式差异的情况,例如不得同时出现“无线洗地机5”和“无线洗地机 5”这类仅空格/格式有区别的命名,需统一为规范表述;
(4)current:判断该商品与给定查询关键词是否存在关联,关联判定范围包括但不限于:关键词为该商品的品牌名、关键词为该品牌旗下的子品牌/系列名称、商品属于该关键词对应的品牌产品线;只要满足上述任意一种关联情形,该字段取值为1,若不存在任何关联则取值为0。
1. 需为商品列表中的每一件商品单独生成一条匹配记录,每条记录必须固定包含以下5个字段,各字段的取值规则明确如下:
(1)row_id:原样返回输入商品中的row_id,禁止修改、遗漏、重新编号或与其他商品交换;
(2)produce_name:填写对应商品的完整原始名称,即商品列表中给出的该商品全称,不得做任何增删修改;
(3)brand:填写该商品对应的SPU品牌名称,需精准识别商品所属品牌,参考示例:“北京同仁堂陈皮茯苓茶”的品牌取值为“北京同仁堂”,“红魔11 Pro+”的品牌取值为“红魔”;若商品无明确可识别的品牌信息,则直接返回该商品的完整名称作为brand字段值;
(4)spu_name:填写该商品的标准SPU名称,即去除品牌前缀后的商品核心名称,参考示例:“北京同仁堂陈皮茯苓茶”的spu_name取值为“陈皮茯苓茶”,“一加 Ace 6 至尊版”的spu_name取值为“Ace 6 至尊版”;需注意同一款商品的spu_name表述必须完全统一,禁止出现同一SPU存在空格差异、格式差异的情况,例如不得同时出现“无线洗地机5”和“无线洗地机 5”这类仅空格/格式有区别的命名,需统一为规范表述;
(5)current:判断该商品与给定查询关键词是否存在关联,关联判定范围包括但不限于:关键词为该商品的品牌名、关键词为该品牌旗下的子品牌/系列名称、商品属于该关键词对应的品牌产品线;只要满足上述任意一种关联情形,该字段取值为1,若不存在任何关联则取值为0。
2. 一致性校验特别要求:同批次传入的商品中,若商品标题指向的品牌名相同,brand字段的取值必须保持完全统一,禁止出现同一品牌同时标注“小米”和“xiaomi”这类中英文/不同写法混用的情况,需统一为规范名称;同批次商品的spu_name也需保持表述一致,禁止出现同一SPU同时标注“12 promax”和“12promax”这类格式不统一的情况,需统一为规范表述。
3。row_id关联要求:
(1)输出的product_words数量必须与输入的product_list数量完全一致;
(2)每个输入row_id必须在输出中出现且只能出现一次;
(3)不得输出输入中不存在的row_id;
(4)row_id只用于数据关联,不参与商品分析;
(5)输出顺序可以变化,但row_id与商品信息的对应关系不得变化。
{
"row_id": 0,
"produce_name": "郎酒 红花郎15",
"brand": "郎酒",
"spu_name": "郎酒 红花郎15",
"spu_name": "红花郎15",
"current": 1
},
}
"""
},
{
"role": "user",
"content": f"""需要处理的商品列表:{product_list} 本次查询的关键词为:{keyword}"""
"content": json.dumps({"product_list": product_list,"keyword": keyword,},ensure_ascii=False,)
}
],
"thinking": {
......@@ -188,6 +199,10 @@ def ai_get_product_relation_spu(product_list, keyword):
"items": {
"type": "object",
"properties": {
"row_id": {
"type": "integer",
"description": "原样返回输入商品的row_id",
},
"produce_name": {
"type": "string",
"description": "商品完整原始名称",
......@@ -207,6 +222,7 @@ def ai_get_product_relation_spu(product_list, keyword):
},
},
"required": [
"row_id",
"produce_name",
"brand",
"spu_name",
......@@ -255,6 +271,7 @@ def ai_get_product_relation_spu(product_list, keyword):
return product_words if isinstance(product_words, list) else []
except Exception as e:
print("AI调用失败:", repr(e))
return []
def ai_get_product_list_search(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