diff --git a/frontend/src/pages/settings/DataSourceEditor.tsx b/frontend/src/pages/settings/DataSourceEditor.tsx index 27dd3df..26a0fdb 100644 --- a/frontend/src/pages/settings/DataSourceEditor.tsx +++ b/frontend/src/pages/settings/DataSourceEditor.tsx @@ -192,15 +192,15 @@ export function DataSourceEditor({ {!isNew && !isActive && config.name.trim() && ( )} {!isNew && onDelete && ( diff --git a/frontend/src/pages/settings/DataSources.tsx b/frontend/src/pages/settings/DataSources.tsx index 05b147c..942c623 100644 --- a/frontend/src/pages/settings/DataSources.tsx +++ b/frontend/src/pages/settings/DataSources.tsx @@ -27,6 +27,9 @@ export function SettingsDataSourcesPanel() { mutationFn: api.reloadDataSources, onSuccess: () => { qc.invalidateQueries({ queryKey: QK.dataSources }) + // 重载可能改变数据集声明 → 能力与实时模式随之变化 + qc.invalidateQueries({ queryKey: QK.capabilities }) + qc.invalidateQueries({ queryKey: QK.quoteStatus }) toast('配置已重新加载', 'success') }, }) @@ -36,6 +39,8 @@ export function SettingsDataSourcesPanel() { onSuccess: () => { qc.invalidateQueries({ queryKey: QK.dataSources }) qc.invalidateQueries({ queryKey: QK.preferences }) + qc.invalidateQueries({ queryKey: QK.capabilities }) + qc.invalidateQueries({ queryKey: QK.quoteStatus }) setSelected('tickflow') setConfirmDelete(null) toast('数据源已删除', 'success') @@ -71,6 +76,9 @@ export function SettingsDataSourcesPanel() { }, onSuccess: () => { qc.invalidateQueries({ queryKey: QK.preferences }) + qc.invalidateQueries({ queryKey: QK.capabilities }) + // 切换会改变实时行情 provider → 模式(none/watchlist/full_market)立即刷新 + qc.invalidateQueries({ queryKey: QK.quoteStatus }) toast('数据源已切换', 'success') }, }) @@ -84,6 +92,8 @@ export function SettingsDataSourcesPanel() { mutationFn: (name: string) => api.installPlugin(name), onSuccess: (data) => { qc.invalidateQueries({ queryKey: QK.dataSources }) + qc.invalidateQueries({ queryKey: QK.capabilities }) + qc.invalidateQueries({ queryKey: QK.quoteStatus }) if (data.install_ok) { toast('插件依赖安装成功', 'success') } else { @@ -98,6 +108,8 @@ export function SettingsDataSourcesPanel() { onSuccess: (data) => { qc.invalidateQueries({ queryKey: QK.dataSources }) qc.invalidateQueries({ queryKey: QK.preferences }) + qc.invalidateQueries({ queryKey: QK.capabilities }) + qc.invalidateQueries({ queryKey: QK.quoteStatus }) if (data.uninstall_ok) { toast(data.uninstall_message || '已卸载', 'success') } else { @@ -154,6 +166,19 @@ export function SettingsDataSourcesPanel() { + {/* 插件化说明 (置顶黄色提示条): 接入自有行情 → 把文档交给 AI */} +
+ +
+ 数据源已插件化 + ,接入自有行情?把文档发给 AI 即可自动接入: + docs/custom-data-source.md + (自有 HTTP 接口) · + docs/plugin-development.md + (插件开发) +
+
+ {/* 当前数据源状态 */}
当前 @@ -199,10 +224,10 @@ export function SettingsDataSourcesPanel() { {item.display_name} {item.name === 'tickflow' && ( - 第三方 + 第三方 )} {pluginNames.has(item.name) && ( - 第三方 + 第三方 )} {/* 右侧操作区: 插件未安装→安装按钮; 已激活→使用中; 否则→使用/卸载 */} {pluginUnavailable ? ( @@ -257,7 +282,8 @@ export function SettingsDataSourcesPanel() { )}
{item.name !== 'tickflow' && item.datasets.length > 0 && ( -
+
+ 已适配 {item.datasets.map(ds => ( {DATASET_LABEL[ds] || ds} @@ -266,7 +292,10 @@ export function SettingsDataSourcesPanel() {
)} {item.name === 'tickflow' && ( -
日K · 除权 · 实时 · 分钟K
+
+ 已适配 + 日K · 除权 · 实时 · 分钟K +
)} {/* 未安装插件显示安装命令提示 */} {pluginUnavailable && plugin?.install_hint && ( @@ -312,22 +341,6 @@ export function SettingsDataSourcesPanel() { 未启用的数据集自动回退 TickFlow
- {/* 插件化说明 + 第三方数据源配置文档指引 (与引导页同口径) */} -
- -
- 数据源已插件化 - ,接入自有行情有两条路径:用 YAML 描述自有 HTTP 接口,放入 - data/data_sources/*.yaml - (也可用「新增数据源」表单配置);或开发插件源,放入 - backend/app/plugins/ - 目录。接入方法与字段映射详见 - docs/custom-data-source.md - 与 - docs/plugin-development.md - 。 -
-
{/* ===== 下方: 编辑区 ===== */} @@ -352,6 +365,10 @@ export function SettingsDataSourcesPanel() { onCancel={() => setSelected('tickflow')} onSaved={() => { qc.invalidateQueries({ queryKey: QK.dataSources }) + // 数据集声明变化 → 能力增广与实时模式立即刷新 + qc.invalidateQueries({ queryKey: QK.preferences }) + qc.invalidateQueries({ queryKey: QK.capabilities }) + qc.invalidateQueries({ queryKey: QK.quoteStatus }) // 强制清除该源的详情缓存, 下次编辑重新拉取最新配置 if (selected !== '__new__') { qc.removeQueries({ queryKey: ['data-source-detail', selected] }) @@ -430,15 +447,16 @@ function PluginDetail({ plugin, isActive, onSwitch, switching }: {
{isActive ? ( - - 当前使用中 + + 使用中 ) : ( )} @@ -458,10 +476,10 @@ function TickFlowDetail({ active, onSwitch, switching }: { active: boolean; onSw

TickFlow

- 第三方 + 第三方 {active && ( - - 当前使用 + + 使用中 )}
@@ -474,9 +492,9 @@ function TickFlowDetail({ active, onSwitch, switching }: { active: boolean; onSw
{[ { label: '日K', desc: '历史 + 实时覆写' }, - { label: '除权因子', desc: 'Starter+ 能力' }, + { label: '除权因子', desc: '复权计算' }, { label: '实时行情', desc: '全市场快照' }, - { label: '分钟K', desc: 'Pro+ 能力' }, + { label: '分钟K', desc: '分时图 · 回测' }, ].map(f => (
{f.label}
@@ -489,7 +507,7 @@ function TickFlowDetail({ active, onSwitch, switching }: { active: boolean; onSw