Skip to content

Commit 07557e3

Browse files
committed
feat(ai-insights): admin settings section
1 parent 5feef84 commit 07557e3

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

src/views/setting/tabs/sections/ai-config.tsx

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Globe as GlobeIcon,
66
Languages as LanguagesIcon,
77
Plus as PlusIcon,
8+
Telescope as TelescopeIcon,
89
X as XIcon,
910
Zap as ZapIcon,
1011
} from 'lucide-vue-next'
@@ -48,12 +49,19 @@ interface AIConfig {
4849
writerModel?: AIModelAssignment
4950
commentReviewModel?: AIModelAssignment
5051
translationModel?: AIModelAssignment
52+
insightsModel?: AIModelAssignment
53+
insightsTranslationModel?: AIModelAssignment
5154
enableSummary: boolean
5255
enableAutoGenerateSummary: boolean
5356
summaryTargetLanguages?: string[]
5457
enableTranslation?: boolean
5558
enableAutoGenerateTranslation?: boolean
5659
translationTargetLanguages?: string[]
60+
enableInsights?: boolean
61+
enableAutoGenerateInsightsOnCreate?: boolean
62+
enableAutoGenerateInsightsOnUpdate?: boolean
63+
enableAutoTranslateInsights?: boolean
64+
insightsTargetLanguages?: string[]
5765
}
5866

5967
interface ModelInfo {
@@ -840,6 +848,24 @@ export const AIConfigSection = defineComponent({
840848
providerModels={providerModels.value || {}}
841849
onUpdate={(a) => updateConfig({ translationModel: a })}
842850
/>
851+
852+
<AIModelAssignmentRow
853+
label="精读生成"
854+
description="用于生成长篇精读的模型"
855+
assignment={config.value.insightsModel}
856+
providers={config.value.providers || []}
857+
providerModels={providerModels.value || {}}
858+
onUpdate={(a) => updateConfig({ insightsModel: a })}
859+
/>
860+
861+
<AIModelAssignmentRow
862+
label="精读翻译"
863+
description="用于翻译精读的模型,留空则复用翻译模型"
864+
assignment={config.value.insightsTranslationModel}
865+
providers={config.value.providers || []}
866+
providerModels={providerModels.value || {}}
867+
onUpdate={(a) => updateConfig({ insightsTranslationModel: a })}
868+
/>
843869
</SettingsSection>
844870

845871
<SettingsSection
@@ -879,6 +905,71 @@ export const AIConfigSection = defineComponent({
879905
</SettingsRow>
880906
</SettingsSection>
881907

908+
<SettingsSection
909+
title="AI 精读"
910+
description="在摘要之外输出长篇精读版本,含结构化章节"
911+
icon={TelescopeIcon}
912+
>
913+
<SettingsRow title="启用 AI 精读">
914+
<NSwitch
915+
value={config.value.enableInsights}
916+
onUpdateValue={(v: boolean) =>
917+
updateConfig({ enableInsights: v })
918+
}
919+
/>
920+
</SettingsRow>
921+
922+
<SettingsRow
923+
title="文章创建时自动生成精读"
924+
description="发布文章时自动生成精读(需要先启用 AI 精读)"
925+
>
926+
<NSwitch
927+
value={config.value.enableAutoGenerateInsightsOnCreate}
928+
onUpdateValue={(v: boolean) =>
929+
updateConfig({ enableAutoGenerateInsightsOnCreate: v })
930+
}
931+
disabled={!config.value.enableInsights}
932+
/>
933+
</SettingsRow>
934+
935+
<SettingsRow
936+
title="文章更新时重新生成精读"
937+
description="文章内容变更时重新生成精读"
938+
>
939+
<NSwitch
940+
value={config.value.enableAutoGenerateInsightsOnUpdate}
941+
onUpdateValue={(v: boolean) =>
942+
updateConfig({ enableAutoGenerateInsightsOnUpdate: v })
943+
}
944+
disabled={!config.value.enableInsights}
945+
/>
946+
</SettingsRow>
947+
948+
<SettingsRow
949+
title="自动翻译精读"
950+
description="精读生成后按目标语言自动翻译"
951+
>
952+
<NSwitch
953+
value={config.value.enableAutoTranslateInsights}
954+
onUpdateValue={(v: boolean) =>
955+
updateConfig({ enableAutoTranslateInsights: v })
956+
}
957+
disabled={!config.value.enableInsights}
958+
/>
959+
</SettingsRow>
960+
961+
<SettingsRow
962+
title="精读目标语言"
963+
description="自动翻译精读的目标语言列表,使用 ISO 639-1 语言代码"
964+
>
965+
<TranslationLanguagesInput
966+
value={config.value.insightsTargetLanguages || []}
967+
onUpdate={(v) => updateConfig({ insightsTargetLanguages: v })}
968+
disabled={!config.value.enableInsights}
969+
/>
970+
</SettingsRow>
971+
</SettingsSection>
972+
882973
<SettingsSection
883974
title="AI 翻译"
884975
description="文章多语言翻译功能配置"

0 commit comments

Comments
 (0)