feat(ui): 新增 LLM 智能增强设置页 + 路由/侧栏 + ArticleDetail 展示排版/分类/插图/点评

This commit is contained in:
Mavis
2026-06-08 14:24:25 +08:00
parent ba2298da0a
commit 38609ff36f
5 changed files with 300 additions and 17 deletions

View File

@@ -44,15 +44,36 @@ export interface ArticleDetail extends ArticleListItem {
body_text: string
body_zh_html?: string | null
body_zh_text?: string | null
body_zh_formatted?: string | null // LLM 排版后 HTML
author?: string | null
image_ai_url?: string | null // LLM 生成的插图
translation_engine?: string | null
translated_at?: string | null
// === LLM 增强状态 ===
format_status?: string | null
classify_status?: string | null
image_ai_status?: string | null
commentary_status?: string | null
// === LLM 内容 ===
commentary?: string | null
entities?: Record<string, any> | null
sentiment?: number | null
duplicate_of?: number | null
}
export interface LlmSetting {
format_prompt?: string | null
classify_prompt?: string | null
commentary_prompt?: string | null
image_prompt_template?: string | null
image_size: string
chat_model: string
image_model: string
interval_sec: number
enabled: boolean
updated_at?: string | null
}
export const articlesApi = {
list(params: Record<string, any> = {}) {
return http.get<ArticleListResponse>('/articles', { params }).then((r) => r.data)
@@ -108,4 +129,24 @@ export const adminApi = {
health() {
return http.get('/admin/health').then((r) => r.data)
},
// === LLM 设置 ===
getLlmSettings() {
return http.get<LlmSetting>('/admin/llm/settings').then((r) => r.data)
},
updateLlmSettings(body: Partial<LlmSetting>) {
return http.put<LlmSetting>('/admin/llm/settings', body).then((r) => r.data)
},
resetLlmSettings() {
return http.post<{ reset: boolean; detail: string }>('/admin/llm/settings/reset').then((r) => r.data)
},
testLlmConnection() {
return http.post<{ ok: boolean; detail: string; configured: boolean }>(
'/admin/llm/settings/test'
).then((r) => r.data)
},
triggerEnrich(articleId: number) {
return http.post<{ triggered: boolean; detail: string; results: Record<string, string> | null }>(
`/admin/llm/enrich/${articleId}`
).then((r) => r.data)
},
}