From b409bffbed0976a7f3bf2148d29442d9aa4f0ffd Mon Sep 17 00:00:00 2001 From: aaron <> Date: Mon, 17 Mar 2025 11:53:17 +0800 Subject: [PATCH] update --- app/core/qwen_client.py | 10 ++++++---- jobs.sqlite | Bin 24576 -> 24576 bytes 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/core/qwen_client.py b/app/core/qwen_client.py index 96a98b1..dc2202f 100644 --- a/app/core/qwen_client.py +++ b/app/core/qwen_client.py @@ -43,9 +43,8 @@ class QwenClient: { "type": "text", "text": "请识别图中信息,提取驿站的名字、取件码、以及运单号(如:顺丰、圆通等快递单号),\ - 取件码和运单号格式一般有:数字加-分割,字母+数字,字母+数字+字母等,\ - 以[{\"station\":\"驿站名字\",\"pickup_codes\":[\"\",\"\"]}]的格式返回给我\ - 已 JSON 格式返回" + 取件码和运单号格式一般有:数字加-分割,字母+数字,字母+数字+字母等。\ + 以JSON 格式:[{\"station\":\"驿站名字\",\"pickup_codes\":[\"\",\"\"]}] 返回" }, { "type": "image", @@ -91,8 +90,11 @@ class QwenClient: if isinstance(item, dict) and 'text' in item: text_content = item.get('text', '') print(f"提取的文本内容: {text_content}") + # 只获取 ```json 和 ``` 之间的内容 + text_content = re.search(r'```json(.*)```', text_content, re.DOTALL).group(1) + # 剔除 ```json 和 ``` - text_content = text_content.replace('```json', '').replace('```', '') + # text_content = text_content.replace('```json', '').replace('```', '') # 尝试直接解析 pickup_data = json.loads(text_content) diff --git a/jobs.sqlite b/jobs.sqlite index 1dba43eb62752f20390f4b46c6cddce7e7d695d7..f3d3f35234ffbac524a3092de17a2f2f2d0e6cc8 100644 GIT binary patch delta 19 bcmZoTz}Rqrae_4C(up$8j7v8rEQkjHN)rcq delta 19 bcmZoTz}Rqrae_4C?1?hYjI%c;EQkjHNqq-q