feat: enhance agent orchestration, knowledge flow and UI refinements

This commit is contained in:
2026-03-29 20:31:13 +08:00
parent d85cb9cf35
commit e0fe3ca623
301 changed files with 1197804 additions and 7863 deletions

View File

@@ -22,6 +22,7 @@ export interface AgentConfig {
description: string
system_prompt: string
enabled: boolean
selected_skill_ids?: string[]
}
export const agentApi = {

35
frontend/src/api/goal.ts Normal file
View File

@@ -0,0 +1,35 @@
import api from './index'
export type GoalStatus = 'active' | 'done' | 'archived'
export interface Goal {
id: string
title: string
note: string | null
goal_date: string
status: GoalStatus
created_at: string
updated_at: string
}
export interface GoalListResponse {
items: Goal[]
}
export const goalApi = {
list(date: string) {
return api.get<GoalListResponse>('/api/goals', { params: { date_str: date } })
},
create(data: { title: string; goal_date: string; note?: string; status?: GoalStatus }) {
return api.post<Goal>('/api/goals', data)
},
update(id: string, data: Partial<Pick<Goal, 'title' | 'note' | 'goal_date' | 'status'>>) {
return api.patch<Goal>(`/api/goals/${id}`, data)
},
delete(id: string) {
return api.delete(`/api/goals/${id}`)
},
}

View File

@@ -18,8 +18,12 @@ function isDev() {
return Boolean(import.meta.env.DEV)
}
function isApiDebugEnabled() {
return import.meta.env.VITE_ENABLE_API_DEBUG === 'true'
}
function debugLog(stage: string, payload: Record<string, unknown>) {
if (!isDev()) return
if (!isDev() || !isApiDebugEnabled()) return
console.debug(`[api:${stage}]`, payload)
}

View File

@@ -0,0 +1,36 @@
import api from './index'
export type ReminderStatus = 'pending' | 'done'
export interface Reminder {
id: string
title: string
note: string | null
reminder_at: string
status: ReminderStatus
is_dismissed: boolean
created_at: string
updated_at: string
}
export interface ReminderListResponse {
items: Reminder[]
}
export const reminderApi = {
list(date: string) {
return api.get<ReminderListResponse>('/api/reminders', { params: { date_str: date } })
},
create(data: { title: string; reminder_at: string; note?: string }) {
return api.post<Reminder>('/api/reminders', data)
},
update(id: string, data: Partial<Pick<Reminder, 'title' | 'note' | 'reminder_at' | 'status' | 'is_dismissed'>>) {
return api.patch<Reminder>(`/api/reminders/${id}`, data)
},
delete(id: string) {
return api.delete(`/api/reminders/${id}`)
},
}

View File

@@ -0,0 +1,43 @@
import api from './index'
import type { Goal } from './goal'
import type { Reminder } from './reminder'
import type { Task } from './task'
import type { Todo } from './todo'
export interface ScheduleCenterDaySummary {
date: string
todo_total: number
todo_completed: number
task_due_total: number
high_priority_total: number
reminder_total: number
goal_total: number
}
export interface ScheduleCenterMonthResponse {
month: string
days: ScheduleCenterDaySummary[]
}
export interface ScheduleCenterDateResponse {
date: string
todos: Todo[]
tasks: Task[]
reminders: Reminder[]
goals: Goal[]
summary: ScheduleCenterDaySummary
generated_at: string
}
export const scheduleCenterApi = {
month(month: string) {
const [year, monthValue] = month.split('-')
return api.get<ScheduleCenterMonthResponse>('/api/schedule-center/month', {
params: { year: Number(year), month: Number(monthValue) },
})
},
date(date: string) {
return api.get<ScheduleCenterDateResponse>('/api/schedule-center/date', { params: { date_str: date } })
},
}

View File

@@ -5,7 +5,8 @@ export type LLMType = 'chat' | 'vlm' | 'embedding' | 'rerank'
export interface LLMModelConfig {
name: string // 模型名称/别名
provider: LLMProvider
// provider 已不再是必填字段:优先通过 base_url + model 推断
provider?: LLMProvider
model: string
base_url: string
api_key: string
@@ -60,7 +61,12 @@ export const settingsApi = {
},
// 测试 LLM 连接
testLLM(data: { type: LLMType } & Omit<LLMModelConfig, 'name' | 'enabled'>) {
testLLM(data: { type: LLMType } & {
model: string
base_url: string
api_key: string
provider?: LLMProvider
}) {
return api.post('/api/settings/llm/test', data)
},

View File

@@ -11,6 +11,7 @@ export interface Skill {
required_context: string[]
output_format: string | null
visibility: 'private' | 'team' | 'market'
is_builtin: boolean
team_id: string | null
is_active: boolean
owner_id: string
@@ -52,4 +53,5 @@ export const skillApi = {
create: (data: SkillCreate): Promise<AxiosResponse<Skill>> => api.post('/api/skills', data),
update: (id: string, data: SkillUpdate): Promise<AxiosResponse<Skill>> => api.put(`/api/skills/${id}`, data),
delete: (id: string): Promise<AxiosResponse<void>> => api.delete(`/api/skills/${id}`),
bootstrapBuiltin: (): Promise<AxiosResponse<Skill[]>> => api.post('/api/skills/bootstrap-builtin'),
}

View File

@@ -4,6 +4,18 @@ export interface SystemStatus {
cpu_percent: number
memory_percent: number
disk_percent: number
disk_used_gb: number
disk_total_gb: number
network_upload_bps: number
network_download_bps: number
system_name: string
system_version: string
hostname: string
uptime_seconds: number
gpu_name: string | null
gpu_memory_total_mb: number | null
gpu_memory_used_mb: number | null
gpu_util_percent: number | null
timestamp: string
}

View File

@@ -17,8 +17,8 @@ export interface Task {
}
export const taskApi = {
list(status?: TaskStatus) {
return api.get<Task[]>('/api/tasks', { params: status ? { status } : {} })
list(filters?: { status?: TaskStatus; due_date?: string; date_from?: string; date_to?: string }) {
return api.get<Task[]>('/api/tasks', { params: filters ?? {} })
},
create(data: { title: string; description?: string; priority?: TaskPriority; due_date?: string }) {

View File

@@ -35,11 +35,11 @@ export const todoApi = {
})
},
create(title: string) {
return api.post<Todo>('/api/todos', { title })
create(data: { title: string; todo_date?: string }) {
return api.post<Todo>('/api/todos', data)
},
update(id: string, data: { title?: string; is_completed?: boolean }) {
update(id: string, data: { title?: string; is_completed?: boolean; todo_date?: string }) {
return api.patch<Todo>(`/api/todos/${id}`, data)
},