feat: AI 对话支持 A2UI 表单/审查/图表与 Agent 工具
This commit is contained in:
@@ -3,7 +3,6 @@ import type {
|
||||
AiApiResponse,
|
||||
AiAttachment,
|
||||
AiConversation,
|
||||
AiMessageFeedback,
|
||||
AiMessagePage,
|
||||
AiReviewSchema,
|
||||
AiReviewSection,
|
||||
@@ -15,8 +14,7 @@ const basePath = '/ai/chat/conversations';
|
||||
|
||||
export const aiChatApi = {
|
||||
listSkills: async () => (await api.get<AiApiResponse<AiSkill[]>>('/ai/chat/skills')).data,
|
||||
listConversations: async () =>
|
||||
(await api.get<AiApiResponse<AiConversation[]>>(basePath)).data,
|
||||
listConversations: async () => (await api.get<AiApiResponse<AiConversation[]>>(basePath)).data,
|
||||
createConversation: async (input?: { title?: string; lockedSkillKey?: string | null }) =>
|
||||
(await api.post<AiApiResponse<AiConversation>>(basePath, input ?? {})).data,
|
||||
updateConversation: async (
|
||||
@@ -26,6 +24,12 @@ export const aiChatApi = {
|
||||
deleteConversation: (id: number) => api.delete<void>(`${basePath}/${id}`),
|
||||
deleteAllConversations: async () =>
|
||||
(await api.delete<{ success: boolean; data: { deleted: number } }>(basePath)).data,
|
||||
deleteMessage: async (conversationId: number, messageId: number) =>
|
||||
(
|
||||
await api.delete<AiApiResponse<{ deletedIds: number[] }>>(
|
||||
`${basePath}/${conversationId}/messages/${messageId}`,
|
||||
)
|
||||
).data,
|
||||
uploadAttachment: async (file: File): Promise<AiAttachment> => {
|
||||
const form = new FormData();
|
||||
form.append('file', file);
|
||||
@@ -37,17 +41,6 @@ export const aiChatApi = {
|
||||
).data;
|
||||
},
|
||||
deleteAttachment: (id: number) => api.delete<void>(`/ai/chat/attachments/${id}`),
|
||||
setFeedback: async (
|
||||
messageId: number,
|
||||
feedback: AiMessageFeedback,
|
||||
reason?: string,
|
||||
) =>
|
||||
(
|
||||
await api.patch<AiApiResponse<{ id: number; feedback: AiMessageFeedback }>>(
|
||||
`/ai/chat/messages/${messageId}/feedback`,
|
||||
{ feedback, reason },
|
||||
)
|
||||
).data,
|
||||
confirmReviewStep: async (
|
||||
reviewId: string,
|
||||
sectionKey: AiReviewSection['key'],
|
||||
@@ -90,7 +83,3 @@ export const aiChatApi = {
|
||||
export function conversationStreamUrl(id: number): string {
|
||||
return `/api${basePath}/${id}/stream`;
|
||||
}
|
||||
|
||||
export function regenerateStreamUrl(conversationId: number, messageId: number): string {
|
||||
return `/api${basePath}/${conversationId}/messages/${messageId}/regenerate/stream`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user