feat:rename subtree from frontend-vue to frontend
This commit is contained in:
74
frontend/src/api/index.ts
Normal file
74
frontend/src/api/index.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
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'>[]) => {
|
||||
return request({
|
||||
url: '/setAgents',
|
||||
data,
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
generateBasePlan = (data: { goal: string; inputs: string[] }) => {
|
||||
return request<unknown, IRawPlanResponse>({
|
||||
url: '/generate_basePlan',
|
||||
method: 'POST',
|
||||
data: {
|
||||
'General Goal': data.goal,
|
||||
'Initial Input Object': data.inputs,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
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()
|
||||
Reference in New Issue
Block a user