新增前后端AI聊天模块,包括流式对话、配置管理和UI组件优化。
This commit is contained in:
33
frontend/src/api/outlines.ts
Normal file
33
frontend/src/api/outlines.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { http } from './client'
|
||||
import type { Outline, OutlineCreate, OutlineUpdate, OutlineList, OutlineReorder } from '@/types/outline'
|
||||
|
||||
const base = (novelId: number) => `/novels/${novelId}/outlines`
|
||||
|
||||
export async function fetchOutlines(novelId: number): Promise<OutlineList> {
|
||||
const { data } = await http.get<OutlineList>(base(novelId))
|
||||
return data
|
||||
}
|
||||
|
||||
export async function fetchOutline(novelId: number, outlineId: number): Promise<Outline> {
|
||||
const { data } = await http.get<Outline>(`${base(novelId)}/${outlineId}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function createOutline(novelId: number, payload: OutlineCreate): Promise<Outline> {
|
||||
const { data } = await http.post<Outline>(base(novelId), payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function updateOutline(novelId: number, outlineId: number, payload: OutlineUpdate): Promise<Outline> {
|
||||
const { data } = await http.patch<Outline>(`${base(novelId)}/${outlineId}`, payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteOutline(novelId: number, outlineId: number): Promise<void> {
|
||||
await http.delete(`${base(novelId)}/${outlineId}`)
|
||||
}
|
||||
|
||||
export async function reorderOutlines(novelId: number, orderedIds: number[]): Promise<OutlineList> {
|
||||
const { data } = await http.put<OutlineList>(`${base(novelId)}/reorder`, { ordered_ids: orderedIds })
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user