56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
|
|
import api from './index'
|
||
|
|
import type { AxiosResponse } from 'axios'
|
||
|
|
|
||
|
|
export interface Skill {
|
||
|
|
id: string
|
||
|
|
name: string
|
||
|
|
description: string | null
|
||
|
|
instructions: string
|
||
|
|
agent_type: string
|
||
|
|
tools: string[]
|
||
|
|
required_context: string[]
|
||
|
|
output_format: string | null
|
||
|
|
visibility: 'private' | 'team' | 'market'
|
||
|
|
team_id: string | null
|
||
|
|
is_active: boolean
|
||
|
|
owner_id: string
|
||
|
|
created_at: string
|
||
|
|
updated_at: string
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface SkillCreate {
|
||
|
|
name: string
|
||
|
|
description?: string
|
||
|
|
instructions: string
|
||
|
|
agent_type: string
|
||
|
|
tools?: string[]
|
||
|
|
required_context?: string[]
|
||
|
|
output_format?: string
|
||
|
|
visibility?: 'private' | 'team' | 'market'
|
||
|
|
team_id?: string
|
||
|
|
is_active?: boolean
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface SkillUpdate {
|
||
|
|
name?: string
|
||
|
|
description?: string
|
||
|
|
instructions?: string
|
||
|
|
agent_type?: string
|
||
|
|
tools?: string[]
|
||
|
|
required_context?: string[]
|
||
|
|
output_format?: string
|
||
|
|
visibility?: 'private' | 'team' | 'market'
|
||
|
|
team_id?: string
|
||
|
|
is_active?: boolean
|
||
|
|
}
|
||
|
|
|
||
|
|
export const skillApi = {
|
||
|
|
list: (params?: { agent_type?: string; visibility?: string }): Promise<AxiosResponse<Skill[]>> => {
|
||
|
|
return api.get('/api/skills', { params })
|
||
|
|
},
|
||
|
|
get: (id: string): Promise<AxiosResponse<Skill>> => api.get(`/api/skills/${id}`),
|
||
|
|
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}`),
|
||
|
|
}
|