- 节点库 outputField 作为可引用输出项:NodeLibraryItem 补类型、getNodeOutputFields 优先返回、upstreamNodes 来源扩展 - script_transcribe 视频总时长支持引用上级输出/手动输入:NodeConfigPanel 引用按钮 + valueSource 存 formConfig 条目,buildOutputConfig 序列化、buildNodeFormConfigFromDsl 回显 - 首页工作空间结果接口切 /ai-agent/session/resultList,会话列表/结果树选项卡拆分独立容错与按需懒加载 - ChatList 滚底感知;引用标签 ElTag type 空值、KeyValueEditor modelValue 空值兜底修复 Co-Authored-By: Claude <noreply@anthropic.com>
135 lines
4.1 KiB
TypeScript
135 lines
4.1 KiB
TypeScript
import request from '/@/utils/request';
|
||
|
||
// ===== 节点库(V2 结构,workflow 专用;creation 继续使用 creation/index.ts 的旧结构)=====
|
||
export interface NodeLibraryPresetOption {
|
||
value?: unknown;
|
||
field: string;
|
||
label: string;
|
||
type: string;
|
||
required: boolean;
|
||
options?: Array<{
|
||
key: string;
|
||
value: string;
|
||
config?: NodeLibraryPresetOption[] | null;
|
||
}> | null;
|
||
// 运行时已在用的扩展字段(补齐声明消除 TS 报错)
|
||
isFormField?: boolean;
|
||
constraint?: any;
|
||
defaultValue?: any;
|
||
}
|
||
|
||
export interface NodeLibraryItem {
|
||
key: string;
|
||
name: string;
|
||
group: string;
|
||
sort: number;
|
||
desc?: string;
|
||
batchExecOption: boolean;
|
||
// 是否允许该节点内「引用上级节点输出」多选(true 时所有引用下拉可多选;节点库返回,仅 model 节点 true)
|
||
isMultiParameter: boolean;
|
||
// 前置/后置方法配置定义(结构同 presetOption,值为数组;仅 model 节点提供)
|
||
preToolOption: NodeLibraryPresetOption[] | null;
|
||
postToolOption: NodeLibraryPresetOption[] | null;
|
||
skillOption: boolean;
|
||
promptOption: boolean;
|
||
negativePromptOption: boolean;
|
||
isSaveFileOption: boolean;
|
||
formConfigOption: boolean;
|
||
modelConfigOption: boolean;
|
||
// 节点自带输出项([{ field, label }]):空/null 表示无输出;非空时该节点可作为下游节点的引用来源
|
||
outputField?: { field: string; label: string }[] | null;
|
||
presetOption: NodeLibraryPresetOption[] | null;
|
||
}
|
||
|
||
export interface NodeLibraryGroup {
|
||
group: { key: string; name: string };
|
||
nodes: NodeLibraryItem[];
|
||
}
|
||
|
||
export function getNodeLibraryList() {
|
||
return request({
|
||
url: '/ai-agent/node/library/list',
|
||
method: 'get',
|
||
}) as Promise<{ code: number; message: string; data: { groups: NodeLibraryGroup[] } }>;
|
||
}
|
||
|
||
// ===== 模型列表(不按类型过滤,显示全部)=====
|
||
export interface WorkflowModelItem {
|
||
id: string;
|
||
modelName: string;
|
||
modelType: number | string;
|
||
baseUrl?: string;
|
||
enabled?: number | boolean;
|
||
isOwner?: number;
|
||
// true = 系统内置模型(选它需填 API Key 转用户模型);false/缺省 = 用户模型
|
||
systemModel?: boolean;
|
||
// 模型请求参数模板(选择模型后渲染为递归表单,与 DSL modelRequestParams 结构一致)
|
||
requestBodyMapping?: Record<string, any>;
|
||
[key: string]: any;
|
||
}
|
||
|
||
export function getWorkflowModelList(params?: {
|
||
pageNum: number;
|
||
pageSize: number;
|
||
modelName?: string;
|
||
isSameType?: boolean;
|
||
modelType?: string | number;
|
||
}) {
|
||
return request({
|
||
url: '/model-gateway/model/manage/listModelManage',
|
||
method: 'get',
|
||
params,
|
||
}) as Promise<{ code: number; message: string; data: { list: WorkflowModelItem[]; total: number } }>;
|
||
}
|
||
|
||
// ===== 技能列表 =====
|
||
export interface WorkflowSkillItem {
|
||
id: number;
|
||
name: string;
|
||
description: string;
|
||
category: string;
|
||
[key: string]: any;
|
||
}
|
||
|
||
export function getWorkflowSkillList(params?: { pageNum: number; pageSize: number; keyword?: string }) {
|
||
return request({
|
||
url: '/ai-agent/skill/user/listUser',
|
||
method: 'get',
|
||
params,
|
||
}) as Promise<{ code: number; message: string; data: { list: WorkflowSkillItem[]; total: number } }>;
|
||
}
|
||
|
||
// ===== 子流程:引入已有工作流(独立实现,不依赖 creation)=====
|
||
export interface SubFlowWorkflowItem {
|
||
id: string;
|
||
// 后端列表接口返回 flowName(name 仅为前端兜底)
|
||
name?: string;
|
||
flowName?: string;
|
||
description?: string;
|
||
[key: string]: any;
|
||
}
|
||
|
||
// 获取"我的工作流"列表(IsOwn=true 只取本人创建,供 sub_flow 节点选择引入)
|
||
// 响应结构多形态容错在调用方处理(data.list ?? data.listFlowUserRes.list)
|
||
export function getSubFlowWorkflowList(params?: {
|
||
pageNum: number;
|
||
pageSize: number;
|
||
keyword?: string;
|
||
IsOwn?: boolean;
|
||
}) {
|
||
return request({
|
||
url: '/ai-agent/flow/user/list',
|
||
method: 'get',
|
||
params,
|
||
}) as Promise<{ code: number; message: string; data: any }>;
|
||
}
|
||
|
||
// 获取工作流详情(取开始节点 outputConfig 构建 sub_flow 引入参数)
|
||
export function getSubFlowWorkflowDetail(id: string) {
|
||
return request({
|
||
url: '/ai-agent/flow/user/get',
|
||
method: 'get',
|
||
params: { id },
|
||
}) as Promise<{ code: number; message: string; data: any }>;
|
||
}
|