import { requestClient } from '#/api/request';

export namespace WorkflowApi {
  export interface WorkflowParams {
    appid: string;
    conversationId: string;
    userId: string;
    inputs: {
      [key: string]: any;
    };
    files: [];
  }
  export interface WorkflowRunBody {
    conversationId: string;
    userId: string;
    inputs: {
      [key: string]: any;
    };
    files: [];
  }
  export interface WorkflowLogParams {
    appid: string;
    lastId?: string;
    page?: number;
    limit?: number;
    keyword?: string;
  }
}

// 工作流
export function sendWorkflow(
  params: WorkflowApi.WorkflowParams,
  data: WorkflowApi.WorkflowRunBody,
) {
  return requestClient.post(`/v1/workflow/run/${params.appid}`, data);
}

// export function runWorkflow(data){
//   return requestClient.post('/v1/workflow/run/stream', data);
// };
//
// export function stopWorkflow(data){
//   return requestClient.patch('/v1/workflow/stop', { data });
// };
//
// export function getWorkflowMessage(data){
//   return requestClient.get('/v1/workflow/info', { data });
// };
//
export function getWorkflowLog(params: WorkflowApi.WorkflowLogParams) {
  return requestClient.post(`/v1/workflow/logs/${params.appid}`, { ...params });
}
