diff --git a/docker-compose.yml b/docker-compose.yml index 8ce67f8..9ea210d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: build: context: . dockerfile: Dockerfile - image: tradus-web:1.3.11 + image: tradus-web:1.3.12 container_name: tradus-web ports: - '6000:80' diff --git a/src/App.vue b/src/App.vue index 7630824..86ce6f0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -320,6 +320,27 @@ onUnmounted(() => { AI分析智能体 + + + + + + + + + 分析历史 + diff --git a/src/router/index.ts b/src/router/index.ts index 26e322f..304cb4b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -44,6 +44,15 @@ const router = createRouter({ title: '智能分析助理', }, }, + { + path: '/analysis-history', + name: 'analysis-history', + component: () => import('../views/AnalysisHistoryView.vue'), + meta: { + requiresAuth: true, + title: '分析历史记录', + }, + }, ], }) diff --git a/src/views/AnalysisHistoryView.vue b/src/views/AnalysisHistoryView.vue new file mode 100644 index 0000000..33230ee --- /dev/null +++ b/src/views/AnalysisHistoryView.vue @@ -0,0 +1,815 @@ + + + + + + + diff --git a/src/views/UniversalAnalysisView.vue b/src/views/UniversalAnalysisView.vue index 5690244..6081ae9 100644 --- a/src/views/UniversalAnalysisView.vue +++ b/src/views/UniversalAnalysisView.vue @@ -134,6 +134,34 @@ const setErrorMessage = (message: string) => { currentThought.value = '分析失败' } +// 保存分析结果到服务器 +const saveAnalysisHistory = async () => { + try { + // 准备提交参数 + const payload: Record = { + content: analysisContent.value, + type: isStockMode.value ? 'astock' : 'crypto', + } + + // 根据不同模式设置不同参数 + if (isStockMode.value) { + payload.symbol = symbolCode.value.trim() + } else { + payload.symbol = symbolCode.value.toUpperCase().trim() + payload.timeframe = selectedTimeframe.value + } + + // 使用http.post发送请求保存分析历史 + const response = await http.post(`${apiBaseUrl}/analysis/analysis_history`, payload) + + if (!response.ok) { + console.error('保存分析历史失败:', response.status) + } + } catch (error) { + console.error('保存分析历史异常:', error) + } +} + // 分析逻辑 const handleAnalysis = async () => { const code = symbolCode.value.trim() @@ -235,6 +263,9 @@ const handleAnalysis = async () => { await scrollToBottom() } currentThought.value = `分析完成 (用时 ${Math.round(data.data.elapsed_time)}秒)` + + // 分析完成后保存结果 + await saveAnalysisHistory() } break