- 为agent.json添加apiUrl、apiKey、apiModel字段支持 - 更新API接口类型定义,支持传递自定义API配置 - 优化AgentRepoList组件UI样式和交互效果 - 增强JSON文件上传校验逻辑,支持API配置验证 - 改进任务结果页面布局和视觉呈现 - 添加任务过程查看抽屉功能 - 实现执行按钮动态样式和悬停效果 - 优化节点连接线渲染逻辑和性能
84 lines
2.2 KiB
TypeScript
84 lines
2.2 KiB
TypeScript
import request from '@/utils/request'
|
|
import type { Agent, IRawPlanResponse } from '@/stores'
|
|
|
|
export interface ActionHistory {
|
|
ID: string
|
|
ActionType: string
|
|
AgentName: string
|
|
Description: string
|
|
ImportantInput: string[]
|
|
Action_Result: string
|
|
}
|
|
|
|
export type IExecuteRawResponse = {
|
|
LogNodeType: string
|
|
NodeId: string
|
|
InputName_List?: string[] | null
|
|
OutputName?: string
|
|
content?: string
|
|
ActionHistory: ActionHistory[]
|
|
}
|
|
|
|
class Api {
|
|
// 智能体信息
|
|
setAgents = (data: Pick<Agent, 'Name' | 'Profile' | 'apiUrl' | 'apiKey' | 'apiModel'>[]) => {
|
|
return request({
|
|
url: '/setAgents',
|
|
data,
|
|
method: 'POST',
|
|
})
|
|
}
|
|
|
|
generateBasePlan = (data: {
|
|
goal: string
|
|
inputs: string[]
|
|
apiUrl?: string
|
|
apiKey?: string
|
|
apiModel?: string
|
|
}) => {
|
|
return request<unknown, IRawPlanResponse>({
|
|
url: '/generate_basePlan',
|
|
method: 'POST',
|
|
data: {
|
|
'General Goal': data.goal,
|
|
'Initial Input Object': data.inputs,
|
|
apiUrl: data.apiUrl,
|
|
apiKey: data.apiKey,
|
|
apiModel: data.apiModel,
|
|
},
|
|
})
|
|
}
|
|
|
|
executePlan = (plan: IRawPlanResponse) => {
|
|
return request<unknown, IExecuteRawResponse[]>({
|
|
url: '/executePlan',
|
|
method: 'POST',
|
|
data: {
|
|
RehearsalLog: [],
|
|
num_StepToRun: null,
|
|
plan: {
|
|
'Initial Input Object': plan['Initial Input Object'],
|
|
'General Goal': plan['General Goal'],
|
|
'Collaboration Process': plan['Collaboration Process']?.map((step) => ({
|
|
StepName: step.StepName,
|
|
TaskContent: step.TaskContent,
|
|
InputObject_List: step.InputObject_List,
|
|
OutputObject: step.OutputObject,
|
|
AgentSelection: step.AgentSelection,
|
|
Collaboration_Brief_frontEnd: step.Collaboration_Brief_FrontEnd,
|
|
TaskProcess: step.TaskProcess.map((action) => ({
|
|
ActionType: action.ActionType,
|
|
AgentName: action.AgentName,
|
|
Description: action.Description,
|
|
ID: action.ID,
|
|
ImportantInput: action.ImportantInput,
|
|
})),
|
|
})),
|
|
},
|
|
},
|
|
})
|
|
}
|
|
}
|
|
|
|
export default new Api()
|