feat(agents): 新增云端智能体入口与草稿编辑

This commit is contained in:
2026-09-10 16:00:37 +08:00
parent 927a85fa22
commit 46fbae9dec
21 changed files with 921 additions and 17 deletions

View File

@@ -0,0 +1,16 @@
import { hostApiFetch } from './host-api';
import { CLOUD_AGENTS_PATH, type CloudAgentDraft, type CloudAgentPage, type CreateCloudAgent, type SaveCloudAgentDraft } from '../../shared/cloud-agents';
export const cloudAgentsApi = {
list: (cursor: string | null = null) => hostApiFetch<CloudAgentPage>(
CLOUD_AGENTS_PATH + '/agents' + (cursor ? `?cursor=${encodeURIComponent(cursor)}` : ''),
),
get: (slug: string) => hostApiFetch<CloudAgentDraft>(`${CLOUD_AGENTS_PATH}/agents/${encodeURIComponent(slug)}`),
create: (input: CreateCloudAgent) => hostApiFetch<CloudAgentDraft>(CLOUD_AGENTS_PATH + '/agents', {
method: 'POST', body: JSON.stringify(input),
}),
save: (slug: string, input: SaveCloudAgentDraft) => hostApiFetch<CloudAgentDraft>(
`${CLOUD_AGENTS_PATH}/agents/${encodeURIComponent(slug)}/draft`,
{ method: 'PATCH', body: JSON.stringify(input) },
),
};