@andrewyang/ai-workflow-editor 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -0
- package/dist/ai-workflow-editor.css +1 -1
- package/dist/ai-workflow-editor.es.js +14745 -26955
- package/dist/ai-workflow-editor.umd.js +87 -129
- package/dist/components/AiWorkflowEditor.d.ts +45 -0
- package/dist/components/ai/AiChatPanel.d.ts +21 -0
- package/dist/components/editor/Canvas.d.ts +31 -0
- package/dist/components/editor/FormatPanel.d.ts +23 -0
- package/dist/components/editor/NodePanel.d.ts +2 -0
- package/dist/components/editor/Toolbar.d.ts +14 -0
- package/dist/components/editor/nodes/AiNode.d.ts +28 -0
- package/dist/components/editor/nodes/NormalNode.d.ts +28 -0
- package/dist/components/editor/nodes/SysmlBlockNode.d.ts +28 -0
- package/dist/components/editor/nodes/SysmlRequirementNode.d.ts +28 -0
- package/dist/components/editor/nodes/SysmlUseCaseNode.d.ts +28 -0
- package/dist/composables/useAi.d.ts +13 -0
- package/dist/index.d.ts +5 -0
- package/dist/types/ai.d.ts +15 -0
- package/dist/types/workflow.d.ts +49 -0
- package/dist/utils/llmAdapter.d.ts +18 -0
- package/package.json +21 -10
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { LlmConfig } from '../types/ai';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
/** 初始工作流数据 */
|
|
5
|
+
initialWorkflow?: {
|
|
6
|
+
nodes: any[];
|
|
7
|
+
edges: any[];
|
|
8
|
+
};
|
|
9
|
+
/** 默认 LLM 配置 */
|
|
10
|
+
defaultLlmConfig?: LlmConfig;
|
|
11
|
+
}>>, {
|
|
12
|
+
exportWorkflow: () => {
|
|
13
|
+
nodes: any[];
|
|
14
|
+
edges: any[];
|
|
15
|
+
} | undefined;
|
|
16
|
+
importWorkflow: (data: any) => void | undefined;
|
|
17
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
18
|
+
save: (workflow: any) => void;
|
|
19
|
+
"node-click": (node: any) => void;
|
|
20
|
+
"edge-click": (edge: any) => void;
|
|
21
|
+
"ai-generate-success": (workflow: any) => void;
|
|
22
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
23
|
+
/** 初始工作流数据 */
|
|
24
|
+
initialWorkflow?: {
|
|
25
|
+
nodes: any[];
|
|
26
|
+
edges: any[];
|
|
27
|
+
};
|
|
28
|
+
/** 默认 LLM 配置 */
|
|
29
|
+
defaultLlmConfig?: LlmConfig;
|
|
30
|
+
}>>> & Readonly<{
|
|
31
|
+
"onNode-click"?: ((node: any) => any) | undefined;
|
|
32
|
+
"onEdge-click"?: ((edge: any) => any) | undefined;
|
|
33
|
+
onSave?: ((workflow: any) => any) | undefined;
|
|
34
|
+
"onAi-generate-success"?: ((workflow: any) => any) | undefined;
|
|
35
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
36
|
+
export default _default;
|
|
37
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
38
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
39
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
40
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
41
|
+
} : {
|
|
42
|
+
type: import('vue').PropType<T[K]>;
|
|
43
|
+
required: true;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
/** 加载状态 */
|
|
3
|
+
loading?: boolean;
|
|
4
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
5
|
+
generate: (prompt: string) => void;
|
|
6
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
7
|
+
/** 加载状态 */
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
}>>> & Readonly<{
|
|
10
|
+
onGenerate?: ((prompt: string) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
14
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
15
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
16
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
17
|
+
} : {
|
|
18
|
+
type: import('vue').PropType<T[K]>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Node, Edge } from '@vue-flow/core';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<{}, {
|
|
4
|
+
addNode: (node: Node) => number;
|
|
5
|
+
exportWorkflow: () => {
|
|
6
|
+
nodes: Node[];
|
|
7
|
+
edges: Edge[];
|
|
8
|
+
};
|
|
9
|
+
importWorkflow: (data: {
|
|
10
|
+
nodes: Node[];
|
|
11
|
+
edges: Edge[];
|
|
12
|
+
}) => void;
|
|
13
|
+
updateNode: (id: string, update: {
|
|
14
|
+
type: string;
|
|
15
|
+
data: any;
|
|
16
|
+
}) => void;
|
|
17
|
+
zoomIn: () => any;
|
|
18
|
+
zoomOut: () => any;
|
|
19
|
+
fitView: () => any;
|
|
20
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
21
|
+
"node-click": (node: Node<any, any, string>) => void;
|
|
22
|
+
"edge-click": (edge: Edge) => void;
|
|
23
|
+
"pane-click": () => void;
|
|
24
|
+
"node-double-click": (node: Node<any, any, string>) => void;
|
|
25
|
+
}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{
|
|
26
|
+
"onNode-click"?: ((node: Node<any, any, string>) => any) | undefined;
|
|
27
|
+
"onEdge-click"?: ((edge: Edge) => any) | undefined;
|
|
28
|
+
"onPane-click"?: (() => any) | undefined;
|
|
29
|
+
"onNode-double-click"?: ((node: Node<any, any, string>) => any) | undefined;
|
|
30
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
31
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
node: any;
|
|
3
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
4
|
+
close: () => void;
|
|
5
|
+
update: (data: any) => void;
|
|
6
|
+
"z-index": (action: string) => void;
|
|
7
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
8
|
+
node: any;
|
|
9
|
+
}>>> & Readonly<{
|
|
10
|
+
onClose?: (() => any) | undefined;
|
|
11
|
+
onUpdate?: ((data: any) => any) | undefined;
|
|
12
|
+
"onZ-index"?: ((action: string) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
16
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
17
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
18
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
19
|
+
} : {
|
|
20
|
+
type: import('vue').PropType<T[K]>;
|
|
21
|
+
required: true;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
2
|
+
"zoom-in": (...args: any[]) => void;
|
|
3
|
+
"zoom-out": (...args: any[]) => void;
|
|
4
|
+
save: (...args: any[]) => void;
|
|
5
|
+
import: (...args: any[]) => void;
|
|
6
|
+
"fit-view": (...args: any[]) => void;
|
|
7
|
+
}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{
|
|
8
|
+
"onZoom-in"?: ((...args: any[]) => any) | undefined;
|
|
9
|
+
"onZoom-out"?: ((...args: any[]) => any) | undefined;
|
|
10
|
+
onSave?: ((...args: any[]) => any) | undefined;
|
|
11
|
+
onImport?: ((...args: any[]) => any) | undefined;
|
|
12
|
+
"onFit-view"?: ((...args: any[]) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
data: {
|
|
4
|
+
label: string;
|
|
5
|
+
style?: any;
|
|
6
|
+
textStyle?: any;
|
|
7
|
+
isEditing?: boolean;
|
|
8
|
+
};
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
11
|
+
data: {
|
|
12
|
+
label: string;
|
|
13
|
+
style?: any;
|
|
14
|
+
textStyle?: any;
|
|
15
|
+
isEditing?: boolean;
|
|
16
|
+
};
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
}>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
22
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
+
} : {
|
|
25
|
+
type: import('vue').PropType<T[K]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
data: {
|
|
4
|
+
label: string;
|
|
5
|
+
style?: any;
|
|
6
|
+
textStyle?: any;
|
|
7
|
+
isEditing?: boolean;
|
|
8
|
+
};
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
11
|
+
data: {
|
|
12
|
+
label: string;
|
|
13
|
+
style?: any;
|
|
14
|
+
textStyle?: any;
|
|
15
|
+
isEditing?: boolean;
|
|
16
|
+
};
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
}>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
22
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
+
} : {
|
|
25
|
+
type: import('vue').PropType<T[K]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
data: {
|
|
4
|
+
label: string;
|
|
5
|
+
style?: any;
|
|
6
|
+
textStyle?: any;
|
|
7
|
+
isEditing?: boolean;
|
|
8
|
+
};
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
11
|
+
data: {
|
|
12
|
+
label: string;
|
|
13
|
+
style?: any;
|
|
14
|
+
textStyle?: any;
|
|
15
|
+
isEditing?: boolean;
|
|
16
|
+
};
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
}>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
22
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
+
} : {
|
|
25
|
+
type: import('vue').PropType<T[K]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
data: {
|
|
4
|
+
label: string;
|
|
5
|
+
style?: any;
|
|
6
|
+
textStyle?: any;
|
|
7
|
+
isEditing?: boolean;
|
|
8
|
+
};
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
11
|
+
data: {
|
|
12
|
+
label: string;
|
|
13
|
+
style?: any;
|
|
14
|
+
textStyle?: any;
|
|
15
|
+
isEditing?: boolean;
|
|
16
|
+
};
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
}>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
22
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
+
} : {
|
|
25
|
+
type: import('vue').PropType<T[K]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
data: {
|
|
4
|
+
label: string;
|
|
5
|
+
style?: any;
|
|
6
|
+
textStyle?: any;
|
|
7
|
+
isEditing?: boolean;
|
|
8
|
+
};
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
11
|
+
data: {
|
|
12
|
+
label: string;
|
|
13
|
+
style?: any;
|
|
14
|
+
textStyle?: any;
|
|
15
|
+
isEditing?: boolean;
|
|
16
|
+
};
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
}>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
22
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
+
} : {
|
|
25
|
+
type: import('vue').PropType<T[K]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AiGenerateWorkflowParams, WorkflowNode, WorkflowEdge } from '../types/workflow';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AI 工作流生成 Composable
|
|
5
|
+
*/
|
|
6
|
+
export declare const useAi: () => {
|
|
7
|
+
loading: import('vue').Ref<boolean, boolean>;
|
|
8
|
+
error: import('vue').Ref<string | null, string | null>;
|
|
9
|
+
generateWorkflow: (params: AiGenerateWorkflowParams) => Promise<{
|
|
10
|
+
nodes: WorkflowNode[];
|
|
11
|
+
edges: WorkflowEdge[];
|
|
12
|
+
}>;
|
|
13
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM (大语言模型) 配置接口
|
|
3
|
+
*/
|
|
4
|
+
export interface LlmConfig {
|
|
5
|
+
/** 模型提供商: 'openai' 或 'ollama' */
|
|
6
|
+
provider: 'openai' | 'ollama';
|
|
7
|
+
/** 模型名称 */
|
|
8
|
+
model: string;
|
|
9
|
+
/** 温度参数 (控制随机性) */
|
|
10
|
+
temperature: number;
|
|
11
|
+
/** API 密钥 (OpenAI 必需) */
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
/** API 基础 URL (Ollama 或自定义 OpenAI 代理必需) */
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { LlmConfig } from './ai';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 工作流节点接口
|
|
5
|
+
*/
|
|
6
|
+
export interface WorkflowNode {
|
|
7
|
+
/** 节点唯一标识符 */
|
|
8
|
+
id: string;
|
|
9
|
+
/** 节点类型 */
|
|
10
|
+
type: string;
|
|
11
|
+
/** 节点数据 */
|
|
12
|
+
data: {
|
|
13
|
+
/** 节点标签/名称 */
|
|
14
|
+
label: string;
|
|
15
|
+
/** 节点属性集合 */
|
|
16
|
+
props?: Record<string, any>;
|
|
17
|
+
/** 节点关联的 LLM 配置 */
|
|
18
|
+
llmConfig?: LlmConfig;
|
|
19
|
+
};
|
|
20
|
+
/** 节点位置坐标 */
|
|
21
|
+
position: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 工作流连线接口
|
|
28
|
+
*/
|
|
29
|
+
export interface WorkflowEdge {
|
|
30
|
+
/** 连线唯一标识符 */
|
|
31
|
+
id: string;
|
|
32
|
+
/** 源节点 ID */
|
|
33
|
+
source: string;
|
|
34
|
+
/** 目标节点 ID */
|
|
35
|
+
target: string;
|
|
36
|
+
/** 连线标签 */
|
|
37
|
+
label?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* AI 生成工作流参数接口
|
|
41
|
+
*/
|
|
42
|
+
export interface AiGenerateWorkflowParams {
|
|
43
|
+
/** 用户提示词 */
|
|
44
|
+
prompt: string;
|
|
45
|
+
/** LLM 配置信息 */
|
|
46
|
+
llmConfig: LlmConfig;
|
|
47
|
+
/** 允许使用的节点类型列表 */
|
|
48
|
+
nodeTypes?: string[];
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChatOpenAI } from '@langchain/openai';
|
|
2
|
+
import { ChatOllama } from '@langchain/community/chat_models/ollama';
|
|
3
|
+
import { LlmConfig } from '../types/ai';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LLM 客户端适配器
|
|
7
|
+
* 统一封装 OpenAI 和 Ollama 的调用接口
|
|
8
|
+
*/
|
|
9
|
+
export declare class LlmClient {
|
|
10
|
+
client: ChatOpenAI | ChatOllama;
|
|
11
|
+
constructor(config: LlmConfig);
|
|
12
|
+
/**
|
|
13
|
+
* 统一调用方法
|
|
14
|
+
* @param prompt 提示词
|
|
15
|
+
* @returns AI 响应内容
|
|
16
|
+
*/
|
|
17
|
+
invoke(prompt: string): Promise<string>;
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrewyang/ai-workflow-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/ai-workflow-editor.umd.js",
|
|
6
6
|
"module": "./dist/ai-workflow-editor.es.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
7
8
|
"style": "./dist/ai-workflow-editor.css",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
10
12
|
"import": "./dist/ai-workflow-editor.es.js",
|
|
11
13
|
"require": "./dist/ai-workflow-editor.umd.js"
|
|
12
14
|
},
|
|
@@ -18,36 +20,45 @@
|
|
|
18
20
|
"private": false,
|
|
19
21
|
"scripts": {
|
|
20
22
|
"build": "nuxt build",
|
|
21
|
-
"build:lib": "vite build --config vite.config.lib.ts",
|
|
23
|
+
"build:lib": "vue-tsc --noEmit && vite build --config vite.config.lib.ts",
|
|
22
24
|
"dev": "nuxt dev",
|
|
23
25
|
"generate": "nuxt generate",
|
|
24
26
|
"preview": "nuxt preview",
|
|
25
|
-
"postinstall": "nuxt prepare"
|
|
27
|
+
"postinstall": "nuxt prepare",
|
|
28
|
+
"prepublishOnly": "npm run build:lib"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
26
32
|
},
|
|
27
33
|
"dependencies": {
|
|
28
|
-
"@element-plus/nuxt": "^1.1.5",
|
|
29
34
|
"@langchain/community": "^0.3.28",
|
|
30
35
|
"@langchain/core": "^0.3.37",
|
|
31
36
|
"@langchain/openai": "^0.4.2",
|
|
32
|
-
"@nuxtjs/i18n": "^10.2.3",
|
|
33
37
|
"@vue-flow/background": "^1.3.0",
|
|
34
38
|
"@vue-flow/controls": "^1.1.2",
|
|
35
39
|
"@vue-flow/core": "^1.41.0",
|
|
36
40
|
"@vue-flow/node-resizer": "^1.5.1",
|
|
37
41
|
"clsx": "^2.1.0",
|
|
38
|
-
"element-plus": "^2.13.2",
|
|
39
42
|
"lucide-vue-next": "^0.344.0",
|
|
40
|
-
"nuxt": "^3.0.0",
|
|
41
43
|
"tailwind-merge": "^2.2.1",
|
|
42
|
-
"vue": "^3.4.0",
|
|
43
44
|
"zod": "^3.22.4"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
47
|
+
"@element-plus/nuxt": "^1.1.5",
|
|
48
|
+
"@nuxtjs/i18n": "^10.2.3",
|
|
46
49
|
"@unocss/nuxt": "^0.58.5",
|
|
47
|
-
"
|
|
50
|
+
"@unocss/vite": "^66.6.1",
|
|
51
|
+
"element-plus": "^2.13.2",
|
|
52
|
+
"nuxt": "^3.0.0",
|
|
53
|
+
"typescript": "^5.3.3",
|
|
54
|
+
"unocss": "^66.6.1",
|
|
55
|
+
"vite": "^7.3.1",
|
|
56
|
+
"vite-plugin-dts": "^3.7.3",
|
|
57
|
+
"vue": "^3.4.0",
|
|
58
|
+
"vue-tsc": "^2.0.0"
|
|
48
59
|
},
|
|
49
60
|
"peerDependencies": {
|
|
50
|
-
"
|
|
61
|
+
"element-plus": "^2.0.0",
|
|
51
62
|
"vue": "^3.4.0"
|
|
52
63
|
},
|
|
53
64
|
"overrides": {
|