From a08f65c960790f7363b89f1ec44745bf23c7e746 Mon Sep 17 00:00:00 2001 From: macbook-maxwell Date: Thu, 27 Nov 2025 22:38:55 +0800 Subject: [PATCH] update --- ...数学题目分析与验证(后端).md | 184 ++++++++++++------ 1 file changed, 121 insertions(+), 63 deletions(-) rename 数学图谱后端接口定义.md => MathVerify Pro智能数学题目分析与验证(后端).md (89%) diff --git a/数学图谱后端接口定义.md b/MathVerify Pro智能数学题目分析与验证(后端).md similarity index 89% rename from 数学图谱后端接口定义.md rename to MathVerify Pro智能数学题目分析与验证(后端).md index 6d8ffbf..0c00c5c 100644 --- a/数学图谱后端接口定义.md +++ b/MathVerify Pro智能数学题目分析与验证(后端).md @@ -1,8 +1,30 @@ +# 应用简介 +MathVerify Pro智能数学题目分析与验证系统,是用于高中数学题目分析的工具,主要是通过把试卷切割成一小题一小题的题目,并通过AI分析题目所涉及的知识点和方法,再通过人工验证,一方面来确定AI的分析正确与否;另一方面,可以把这些数学题的正确的知识点方法存储起来,用于后期知识库、知识图谱的使用,以及AI Agent或数学模型的使用。 -## 外部接口 +MathVerify Pro智能数学题目分析与验证系统分为前端和后端两部分。 +前端又分为:试卷分析和题目验证两部分。参考前端代码和前端部分的README.md -> 外部接口,是后端应用程序请求的外部api,不是提供给前端直接使用的。后端请求了这些api以后还要进行处理后,再提供给前端使用。 +## 后端应用程序的工作流程: +### 试卷分析过程: +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: @@ -400,7 +422,7 @@ https://ekt1.suzhou.edu.cn/autocut/files/20251125_082929_f1975f5c/question_003.j https://ekt1.suzhou.edu.cn/autocut/files/20251125_082929_f1975f5c/question_014.jpg ``` -question_id 也需要记录。其他字段忽略. +question_id 也需要记录。其他字段可忽略. 返回错误包括:只支持图片格式: { @@ -416,6 +438,8 @@ question_id 也需要记录。其他字段忽略. ### 2. ocr api: +注意:这是一个ai模型接口,可能会存在一些不可预知的错误,需要做好错误处理,比如,返回的内容 "content"字段中,有可能带上markdown标记,也有可能不带。模型有可能因超时或其他原因,返回错误。请合理处理错误。 + 输入:上面的切割试卷api所生成的url; 输出:markdown形式的带有数学公式的题目文本内容。 大模型api地址:https://ekt1.suzhou.edu.cn/llm/v1/chat/completions @@ -424,6 +448,7 @@ openai兼容格式 上传需要先把url解析成base64。模型不能直接识别url。 设定温度为0; 设定提示词是: + ``` 你是一名数学文字识别专家。你的任务是,将图片中的文字,严格转换为markdown格式的文字;如图中有数学公式,你必须使用$或者$$进行包裹,生成markdown可解析的latex格式的数学公式;你无需输出其他任何解释性文字,只需严格输出图片中的文字。 ``` @@ -506,9 +531,9 @@ openai兼容格式 ### 3. 题目分析api: - **请求方式:** POST - + - **请求URL**:` https://aimaster.apps.k8s.aiscenes.cn/dev-api/aimaster/scenario/open/api` - + `https://aimaster.apps.k8s.aiscenes.cn/`为域名 /dev-api/ 是测试环境, 目前只有测试环境 @@ -516,28 +541,28 @@ openai兼容格式 /aimaster/scenario/open/api 为固定后缀 - **request**: - + header参数说明: -| 字段名 | 类型 | 说明 | -| ------------- | ------ | ----------------------------------------------------------------- | -| Authorization | String | token登录获取,给固定值Bearer W/cbr9kftZmnpOqxAfiLvRVZx2+9Lf6X9I9FS+t0zK4= | -| | | | +| 字段名 | 类型 | 说明 | +| ------------- | ------ | ------------------------------------------------------------ | +| Authorization | String | token登录获取,给固定值Bearer wo54FKODEaPi9ip3NbjbE0/2YtIom1oyQXvlvqsLEpc= | +| | | | 样例: -Authorization:Bearer W/cbr9kftZmnpOqxAfiLvRVZx2+9Lf6X9I9FS+t0zK4= +Authorization:Bearer wo54FKODEaPi9ip3NbjbE0/2YtIom1oyQXvlvqsLEpc= body参数说明: -|字段名|类型|说明| -|---|---|---| -|chatId|String|对话主键,uuid自己生成,同一个id表示一次对话| -|scenarioInfoId|String|场景中心主键| -|latestMessageContent|String|用户最后一次提问| -|params|Object|应用的自定义参数,| - +| 字段名 | 类型 | 说明 | +| -------------------- | ------ | ------------------------------------------ | +| chatId | String | 对话主键,uuid自己生成,同一个id表示一次对话 | +| scenarioInfoId | String | 场景中心主键 | +| latestMessageContent | String | 用户最后一次提问 | +| params | Object | 应用的自定义参数, | + 样例: ```json { @@ -555,159 +580,192 @@ body参数说明: "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 方法(如有),以及其他必要字段; +使用sqlite3 ,直接存储;(知识点、方法,使用sqlite3 的JSON 存储,示例:存入时存为 ["apple", "banana", "cherry"],ORM 映射为 List/Array) +存储切割后的照片base64、原始照片的sessionId、切割后照片的questionId、题目的markdown格式文本(ocr后)、题目的知识点json、题目的方法json,是否verified, updated 知识点(如有);updated 方法(如有),以及其他必要字段; \ No newline at end of file