feat(agents): 新增云端智能体入口与草稿编辑
This commit is contained in:
16
src/lib/cloud-agents-api.ts
Normal file
16
src/lib/cloud-agents-api.ts
Normal 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) },
|
||||
),
|
||||
};
|
||||
Reference in New Issue
Block a user