# 应用简介 MathVerify Pro智能数学题目分析与验证系统,是用于高中数学题目分析的工具,主要是通过把试卷切割成一小题一小题的题目,并通过AI分析题目所涉及的知识点和方法,再通过人工验证,一方面来确定AI的分析正确与否;另一方面,可以把这些数学题的正确的知识点方法存储起来,用于后期知识库、知识图谱的使用,以及AI Agent或数学模型的使用。 MathVerify Pro智能数学题目分析与验证系统分为前端和后端两部分。 前端又分为:试卷分析和题目验证两部分。参考前端代码和前端部分的README.md ## 后端应用程序的工作流程: ### 试卷分析过程: 1. 从前端接收一张或多张试卷的图片(PNG或JPG); 2. 保存到本地文件夹; 3. 逐张发送给`分割试卷API`,把整张试卷分割成一张张的题目图片(简称小题图片); 4. 逐张发送每张小题图片到`ocr api`; 5. 把ocr的结果,发送到`题目分析api`; 6. 把小题图片(需转换为base64)、ocr结果的文本内容、题目分析api,存入数据库;暂时存到sqlite3中; 7. 每一小题存储完成后,就发送到前端,用于显示题目和分析结果; 8. 一张卷子完成以后,发送给前端一个单张卷子任务完成的通知; 9. 所有卷子都完成以后,发送给前端,所有任务完成的通知。 ### 题目验证过程: 1. 前端从数据库中(通过接口)读取未验证的题目,每次10条; 2. 前端更新修改后的数据,并修改标记位为已验证。后端更新完成后,发送通知。 3. ## 涉及到的外部接口 > 外部接口,是后端应用程序请求的外部api,不是提供给前端直接使用的api。后端请求了这些api以后还要进行处理后,再提供给前端使用。 ### 1. 分割试卷API: 请求: ```bash curl --location --request POST 'https://ekt1.suzhou.edu.cn/autocut/detect' \ --header 'Accept: */*' \ --header 'Host: ekt1.suzhou.edu.cn' \ --header 'Connection: keep-alive' \ --header 'Content-Type: multipart/form-data; boundary=--------------------------687058231513459413708701' \ --form 'image=@"/Users/robertmaxwell/code/zstp/AutoCut/pic.png"' \ --form 'enable_error_detection="false"' ``` 返回: ```json { "data": { "crop_results": { "cropped_count": 14, "cropped_images": [ { "bbox": [ 970, 69, 1909, 246 ], "filename": "question_001.jpg", "question_id": 1, "vertical_id": 1 }, { "bbox": [ 41, 107, 970, 253 ], "filename": "question_002.jpg", "question_id": 2, "vertical_id": 2 }, { "bbox": [ 970, 245, 1909, 479 ], "filename": "question_003.jpg", "question_id": 3, "vertical_id": 3 }, { "bbox": [ 41, 254, 970, 394 ], "filename": "question_004.jpg", "question_id": 4, "vertical_id": 4 }, { "bbox": [ 41, 395, 970, 506 ], "filename": "question_005.jpg", "question_id": 5, "vertical_id": 5 }, { "bbox": [ 970, 480, 1909, 661 ], "filename": "question_006.jpg", "question_id": 6, "vertical_id": 6 }, { "bbox": [ 41, 507, 970, 655 ], "filename": "question_007.jpg", "question_id": 7, "vertical_id": 7 }, { "bbox": [ 41, 656, 970, 820 ], "filename": "question_008.jpg", "question_id": 8, "vertical_id": 8 }, { "bbox": [ 970, 662, 1909, 904 ], "filename": "question_009.jpg", "question_id": 9, "vertical_id": 9 }, { "bbox": [ 41, 821, 970, 968 ], "filename": "question_010.jpg", "question_id": 10, "vertical_id": 10 }, { "bbox": [ 970, 905, 1909, 1183 ], "filename": "question_011.jpg", "question_id": 11, "vertical_id": 11 }, { "bbox": [ 41, 969, 970, 1111 ], "filename": "question_012.jpg", "question_id": 12, "vertical_id": 12 }, { "bbox": [ 41, 1112, 970, 1364 ], "filename": "question_013.jpg", "question_id": 13, "vertical_id": 13 }, { "bbox": [ 970, 1184, 1909, 1364 ], "filename": "question_014.jpg", "question_id": 14, "vertical_id": 14 } ], "mode": "all_questions", "zip_url": "/download/20251125_082929_f1975f5c" }, "error_count": 8, "error_details": [ { "error_boxes": [ { "bbox": [ 1772, 678, 44, 44 ], "class_name": "cuo", "confidence": 0.7618222236633301 } ], "match_method": "中心点包含", "question_box": { "bbox": [ 970, 662, 939, 242 ] } }, { "error_boxes": [ { "bbox": [ 1209, 163, 31, 32 ], "class_name": "cuo", "confidence": 0.7555574178695679 } ], "match_method": "中心点包含", "question_box": { "bbox": [ 970, 69, 939, 177 ] } }, { "error_boxes": [ { "bbox": [ 1225, 533, 46, 44 ], "class_name": "cuo", "confidence": 0.7304249405860901 } ], "match_method": "中心点包含", "question_box": { "bbox": [ 970, 480, 939, 181 ] } }, { "error_boxes": [ { "bbox": [ 797, 827, 40, 42 ], "class_name": "cuo", "confidence": 0.7287607192993164 } ], "match_method": "中心点包含", "question_box": { "bbox": [ 41, 821, 929, 147 ] } }, { "error_boxes": [ { "bbox": [ 1299, 363, 33, 33 ], "class_name": "cuo", "confidence": 0.7262661457061768 } ], "match_method": "中心点包含", "question_box": { "bbox": [ 970, 245, 939, 234 ] } }, { "error_boxes": [ { "bbox": [ 1226, 1028, 36, 36 ], "class_name": "cuo", "confidence": 0.7171130776405334 } ], "match_method": "中心点包含", "question_box": { "bbox": [ 970, 905, 939, 278 ] } }, { "error_boxes": [ { "bbox": [ 814, 1116, 36, 37 ], "class_name": "cuo", "confidence": 0.7121084332466125 } ], "match_method": "中心点包含", "question_box": { "bbox": [ 41, 1112, 929, 252 ] } }, { "error_boxes": [ { "bbox": [ 793, 127, 39, 30 ], "class_name": "xie", "confidence": 0.5237091183662415 } ], "match_method": "中心点包含", "question_box": { "bbox": [ 41, 107, 929, 146 ] } } ], "error_symbol_count": 8, "question_count": 14, "session_id": "20251125_082929_f1975f5c", "visualization_images": { "error_symbols": "/visualizations/20251125_082929_f1975f5c/error_symbols.jpg", "matched_errors": "/visualizations/20251125_082929_f1975f5c/matched_errors.jpg", "questions": "/visualizations/20251125_082929_f1975f5c/questions.jpg" } }, "success": true } ``` 被切割后的图片拼接方式: `https://ekt1.suzhou.edu.cn/autocut/files//` 如上图,则被切割了14个图片: ``` https://ekt1.suzhou.edu.cn/autocut/files/20251125_082929_f1975f5c/question_001.jpg https://ekt1.suzhou.edu.cn/autocut/files/20251125_082929_f1975f5c/question_002.jpg https://ekt1.suzhou.edu.cn/autocut/files/20251125_082929_f1975f5c/question_003.jpg ………… ………… https://ekt1.suzhou.edu.cn/autocut/files/20251125_082929_f1975f5c/question_014.jpg ``` question_id 也需要记录。其他字段可忽略. 返回错误包括:只支持图片格式: { "message": "不支持的文件格式", "success": false } 字段缺失或错误: { "message": "没有上传图片文件", "success": false } ### 2. ocr api: 注意:这是一个ai模型接口,可能会存在一些不可预知的错误,需要做好错误处理,比如,返回的内容 "content"字段中,有可能带上markdown标记,也有可能不带。模型有可能因超时或其他原因,返回错误。请合理处理错误。 输入:上面的切割试卷api所生成的url; 输出:markdown形式的带有数学公式的题目文本内容。 大模型api地址:https://ekt1.suzhou.edu.cn/llm/v1/chat/completions openai兼容格式 模型名称:qwen-vl,是一个VL模型。 上传需要先把url解析成base64。模型不能直接识别url。 设定温度为0; 设定提示词是: ``` 你是一名数学文字识别专家。你的任务是,将图片中的文字,严格转换为markdown格式的文字;如图中有数学公式,你必须使用$或者$$进行包裹,生成markdown可解析的latex格式的数学公式;你无需输出其他任何解释性文字,只需严格输出图片中的文字。 ``` 输入示例: `POST: https://ekt1.suzhou.edu.cn/llm/v1/chat/completions` `HEADER: Authonrization: Bearer sk-PqY5sI1od5Hbl6hVsniLDp7G0DOOBlUzE8E22p8HdVSTM5Rs` ```json { "model": "qwen-vl", "messages": [ { "role": "system", "content": "你是一名数学图片文字识别专家。" }, { "role": "user", "content": [ { "type": "text", "text": "你的任务是,将图片中的文字,严格转换为markdown格式的文字;如图中有数学公式,你必须使用$或者$$进行包裹,生成markdown可解析的latex格式的数学公式;你无需输出其他任何解释性文字,只需严格输出图片中的文字。" }, { "type": "image_url", "image_url": { "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABfYAAAGCCAIAAAAt4wW+AAAACXBIWXMAAAsTAAALEwEAm==CC" } } ] } ], "temperature": 0 } ``` 输出格式: ```json { "id": "chatcmpl-08cc11398014472fa86bd8cbdb2ded8b", "object": "chat.completion", "created": 1764146440, "model": "qwen-vl", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "12. 已知集合 $A=\\{1, 2, 4, 8\\}$, $B=\\{z|z=xy, x \\in A, y \\in A\\}$, 则下列四个结论正确的是 ( $\\not A B$ )\n\nA. $A \\nsubseteq B$\n\nB. $\\{1, 4, 16, 64\\} \\subseteq B$\n\nC. 集合 $B$ 中元素的个数为 8\n\nD. 集合 $B$ 的真子集的个数为 127", "refusal": null, "annotations": null, "audio": null, "function_call": null, "tool_calls": [], "reasoning_content": null }, "logprobs": null, "finish_reason": "stop", "stop_reason": null } ], "service_tier": null, "system_fingerprint": null, "usage": { "prompt_tokens": 841, "total_tokens": 972, "completion_tokens": 131, "prompt_tokens_details": null }, "prompt_logprobs": null, "kv_transfer_params": null } ``` "content": 这里面的文字就是ocr的结果。 ### 3. 题目分析api: - **请求方式:** POST - **请求URL**:` https://aimaster.apps.k8s.aiscenes.cn/dev-api/aimaster/scenario/open/api` `https://aimaster.apps.k8s.aiscenes.cn/`为域名 /dev-api/ 是测试环境, 目前只有测试环境 /aimaster/scenario/open/api 为固定后缀 - **request**: header参数说明: | 字段名 | 类型 | 说明 | | ------------- | ------ | ------------------------------------------------------------ | | Authorization | String | token登录获取,给固定值Bearer wo54FKODEaPi9ip3NbjbE0/2YtIom1oyQXvlvqsLEpc= | | | | | 样例: Authorization:Bearer wo54FKODEaPi9ip3NbjbE0/2YtIom1oyQXvlvqsLEpc= body参数说明: | 字段名 | 类型 | 说明 | | -------------------- | ------ | ------------------------------------------ | | chatId | String | 对话主键,uuid自己生成,同一个id表示一次对话 | | scenarioInfoId | String | 场景中心主键 | | latestMessageContent | String | 用户最后一次提问 | | params | Object | 应用的自定义参数, | 样例: ```json { "latestMessageContent": "分析这道数学题:f(x)=2x^2的单调性", "chatId": "706e73c3694146f2b703d0da2c4cd95b", "params": { "userId": "" }, "scenarioInfoId": "e6e822e47fa24ca380f8d2d09eb114a7" } ``` - **response** 1. **流式传输**:采用`data:` 前缀+JSON对象的分块传输格式 样例: ``` data: {"id":"AI Master","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741340356,"model":"ai-master","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":null,"usage":null,"step":null,"agent_step":"Agent Start","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"","function_call":null,"refusal":null,"role":"assistant","tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Start","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"@","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"企业","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"变","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"更","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"助手","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":" 企业","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"迁","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"址","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"所","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"需","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"材料","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"的","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"清","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"单","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":"。","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Starting","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":"stop","index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"fp_b705f0c291","usage":null,"step":"AI Finished","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":null,"usage":{"completion_tokens":15,"prompt_tokens":404,"total_tokens":419,"completion_tokens_details":{"accepted_prediction_tokens":null,"audio_tokens":0,"reasoning_tokens":null,"rejected_prediction_tokens":null},"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0}},"step":null,"agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"chatcmpl-B8PGrW9oyk1P3EiKUHwffLhIxpVg6","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":"stop","index":0,"logprobs":null}],"created":1741343465,"model":"gpt-4o-2024-11-20","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":null,"usage":{"completion_tokens":15,"prompt_tokens":404,"total_tokens":419,"completion_tokens_details":{"accepted_prediction_tokens":null,"audio_tokens":0,"reasoning_tokens":null,"rejected_prediction_tokens":null},"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0}},"step":"AI Finished","agent_step":"Agent Starting","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"AI Master","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741340356,"model":"ai-master","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":null,"usage":null,"step":null,"agent_step":"Agent Finished","agent_id":"d9bdca85-6dce-4dc9-833a-9b3c15a4603b","agent_name":"企业办事指南","function":null} data: {"id":"AI Master","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1741340356,"model":"ai-master","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":null,"usage":null,"step":null,"agent_step":"Agent Start","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: {"id":"01957028d0affb338184706545d352a0","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":"assistant","tool_calls":null,"reasoning_content":""},"finish_reason":null,"index":0,"logprobs":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false}}}],"created":1741343478,"model":"Pro/deepseek-ai/DeepSeek-R1","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"","usage":{"completion_tokens":0,"prompt_tokens":13819,"total_tokens":13819,"completion_tokens_details":null,"prompt_tokens_details":null},"step":"AI Start","agent_step":"Agent Starting","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: {"id":"01957028d0affb338184706545d352a0","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":"assistant","tool_calls":null,"reasoning_content":"好"},"finish_reason":null,"index":0,"logprobs":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false}}}],"created":1741343478,"model":"Pro/deepseek-ai/DeepSeek-R1","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"","usage":{"completion_tokens":1,"prompt_tokens":13819,"total_tokens":13820,"completion_tokens_details":null,"prompt_tokens_details":null},"step":"AI Start","agent_step":"Agent Starting","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: {"id":"01957028d0affb338184706545d352a0","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":"assistant","tool_calls":null,"reasoning_content":",我需要"},"finish_reason":null,"index":0,"logprobs":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false}}}],"created":1741343478,"model":"Pro/deepseek-ai/DeepSeek-R1","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"","usage":{"completion_tokens":3,"prompt_tokens":13819,"total_tokens":13822,"completion_tokens_details":null,"prompt_tokens_details":null},"step":"AI Start","agent_step":"Agent Starting","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: {"id":"01957028d0affb338184706545d352a0","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":"assistant","tool_calls":null,"reasoning_content":"处理"},"finish_reason":null,"index":0,"logprobs":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false}}}],"created":1741343478,"model":"Pro/deepseek-ai/DeepSeek-R1","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"","usage":{"completion_tokens":4,"prompt_tokens":13819,"total_tokens":13823,"completion_tokens_details":null,"prompt_tokens_details":null},"step":"AI Start","agent_step":"Agent Starting","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: {"id":"01957028d0affb338184706545d352a0","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":"assistant","tool_calls":null,"reasoning_content":"用户关于"},"finish_reason":null,"index":0,"logprobs":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false}}}],"created":1741343478,"model":"Pro/deepseek-ai/DeepSeek-R1","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"","usage":{"completion_tokens":6,"prompt_tokens":13819,"total_tokens":13825,"completion_tokens_details":null,"prompt_tokens_details":null},"step":"AI Start","agent_step":"Agent Starting","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: {"id":"01957028d0affb338184706545d352a0","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":"assistant","tool_calls":null,"reasoning_content":"苏州"},"finish_reason":null,"index":0,"logprobs":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false}}}],"created":1741343478,"model":"Pro/deepseek-ai/DeepSeek-R1","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"","usage":{"completion_tokens":7,"prompt_tokens":13819,"total_tokens":13826,"completion_tokens_details":null,"prompt_tokens_details":null},"step":"AI Start","agent_step":"Agent Starting","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: {"id":"01957028d0affb338184706545d352a0","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":"assistant","tool_calls":null,"reasoning_content":"工业园区公司"},"finish_reason":null,"index":0,"logprobs":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false}}}],"created":1741343478,"model":"Pro/deepseek-ai/DeepSeek-R1","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"","usage":{"completion_tokens":9,"prompt_tokens":13819,"total_tokens":13828,"completion_tokens_details":null,"prompt_tokens_details":null},"step":"AI Start","agent_step":"Agent Starting","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: {"id":"01957028d0affb338184706545d352a0","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":"assistant","tool_calls":null,"reasoning_content":"迁"},"finish_reason":null,"index":0,"logprobs":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false}}}],"created":1741343478,"model":"Pro/deepseek-ai/DeepSeek-R1","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"","usage":{"completion_tokens":10,"prompt_tokens":13819,"total_tokens":13829,"completion_tokens_details":null,"prompt_tokens_details":null},"step":"AI Start","agent_step":"Agent Starting","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: {"id":"01957028d0affb338184706545d352a0","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":"assistant","tool_calls":null,"reasoning_content":"址所需"},"finish_reason":null,"index":0,"logprobs":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false}}}],"created":1741343478,"model":"Pro/deepseek-ai/DeepSeek-R1","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"","usage":{"completion_tokens":12,"prompt_tokens":13819,"total_tokens":13831,"completion_tokens_details":null,"prompt_tokens_details":null},"step":"AI Start","agent_step":"Agent Starting","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: {"id":"01957028d0affb338184706545d352a0","choices":[{"delta":{"content":null,"function_call":null,"refusal":null,"role":"assistant","tool_calls":null,"reasoning_content":"材料"},"finish_reason":null,"index":0,"logprobs":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false}}}],"created":1741343478,"model":"Pro/deepseek-ai/DeepSeek-R1","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":"","usage":{"completion_tokens":13,"prompt_tokens":13819,"total_tokens":13832,"completion_tokens_details":null,"prompt_tokens_details":null},"step":"AI Start","agent_step":"Agent Starting","agent_id":"2a9ae314-164c-4771-b250-8043416a12c3","agent_name":"企业变更助手","function":null} data: [DONE] ``` 你需要把流式的response 合并。 返回的格式是: { "input_problem_summary": "简要概括题目(不超过20字)", "analysis": { "knowledges": [ "题目所涉及到的知识点1", "题目所涉及到的知识点2" ], "methods": [ "题目所涉及到的解题方法1", "题目所涉及到的解题方法2" ] } } 输出example: ```json { "input_problem_summary": "已知对数函数含参单调性求参数范围", "analysis": { "knowledges": [ "导数及其应用 - 导数在研究函数中的应用 - 利用导数研究函数的单调性", "基本初等函数 - 对数函数 - 对数函数的导数" ], "methods": [ "转化与化归思想", "分离参数法", "不等式恒成立问题求解" ] } } ``` 注意:虽然prompt已经严格要求输出的内容是json格式,但是有可能AI会增加前面或后面的一些解释,也有可能加入markdown的json代码头,或者直接以`{}`开头,或者以引号开头。你需要预处理这些内容, 以使存储的和给到前端的数据是正确的json格式。 ## 存储 使用sqlite3 ,直接存储;(知识点、方法,使用sqlite3 的JSON 存储,示例:存入时存为 ["apple", "banana", "cherry"],ORM 映射为 List/Array) 存储切割后的照片base64、原始照片的sessionId、切割后照片的questionId、题目的markdown格式文本(ocr后)、题目的知识点json、题目的方法json,是否verified, updated 知识点(如有);updated 方法(如有),以及其他必要字段;