实现了基于OpenAI的流式题目解析系统,支持答题后查看AI生成的详细解析。 主要功能: - 流式输出:采用SSE (Server-Sent Events) 实现实时流式输出,用户可看到解析逐字生成 - Markdown渲染:使用react-markdown渲染解析内容,支持标题、列表、代码块等格式 - 智能提示词:根据题目类型(选择题/填空题/判断题等)动态调整提示词 - 选择题优化:对选择题提供逐项分析和记忆口诀 - 重新生成:支持重新生成解析,temperature设为0确保输出一致性 - 优化加载:加载指示器显示在内容下方,不遮挡流式输出 技术实现: - 后端:新增ExplainQuestionStream方法支持流式响应 - 前端:使用ReadableStream API接收SSE流式数据 - UI:优化加载状态显示,避免阻塞内容展示 - 清理:删除不再使用的scripts脚本文件 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
949 B
JSON
36 lines
949 B
JSON
{
|
|
"name": "ankao-web",
|
|
"private": true,
|
|
"version": "1.0.0",
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "tsc && vite build",
|
|
"preview": "vite preview",
|
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
|
|
},
|
|
"dependencies": {
|
|
"@ant-design/icons": "^6.1.0",
|
|
"antd": "^5.28.0",
|
|
"axios": "^1.6.5",
|
|
"react": "^18.2.0",
|
|
"react-dom": "^18.2.0",
|
|
"react-markdown": "^10.1.0",
|
|
"react-router-dom": "^6.21.3"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^20.11.5",
|
|
"@types/react": "^18.2.48",
|
|
"@types/react-dom": "^18.2.18",
|
|
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
"@typescript-eslint/parser": "^6.19.0",
|
|
"@vitejs/plugin-react": "^4.2.1",
|
|
"eslint": "^8.56.0",
|
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
"eslint-plugin-react-refresh": "^0.4.5",
|
|
"less": "^4.4.2",
|
|
"typescript": "^5.3.3",
|
|
"vite": "^5.0.11"
|
|
}
|
|
}
|