From 8ea48632ee5e0ebbbf57631757397f5337b6a338 Mon Sep 17 00:00:00 2001 From: dongzp <975303544@qq.com> Date: Tue, 21 Jul 2026 19:16:49 +0800 Subject: [PATCH] =?UTF-8?q?AI=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 2 +- src/components/header/SettingsDialog.vue | 14 +++++++------- src/stores/settings.ts | 8 ++++++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/App.vue b/src/App.vue index b856c61..748d2cb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -43,7 +43,7 @@ - + @@ -35,7 +35,7 @@ + \ No newline at end of file diff --git a/src/stores/settings.ts b/src/stores/settings.ts index a5bb3a6..6863ff3 100644 --- a/src/stores/settings.ts +++ b/src/stores/settings.ts @@ -4,6 +4,10 @@ import type { AppSettings } from '../types' const STORAGE_KEY = 'ai-trade-settings' +/** 额外关键字默认:规定 AI 角色与分析能力 */ +export const DEFAULT_KEYWORDS = + '你是一名专业的国内期货交易员和分析员,精通机构操盘手法,能够根据持仓与交易数据分析当前走势。' + function load(): Partial { try { return JSON.parse(localStorage.getItem(STORAGE_KEY) || '{}') as Partial @@ -15,7 +19,7 @@ function load(): Partial { export const useSettingsStore = defineStore('settings', () => { const saved = load() const apiKey = ref(saved.apiKey || '') - const keywords = ref(saved.keywords || '') + const keywords = ref(saved.keywords || DEFAULT_KEYWORDS) watch([apiKey, keywords], () => { const payload: AppSettings = { @@ -23,7 +27,7 @@ export const useSettingsStore = defineStore('settings', () => { keywords: keywords.value, } localStorage.setItem(STORAGE_KEY, JSON.stringify(payload)) - }) + }, { immediate: true }) return { apiKey, keywords } })