@vtj/designer 0.15.1 → 0.16.0
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/dist/Editor-CeRX4KMd.js +4 -0
- package/dist/{index-DJr_meHg.js → index-C_HLiYWQ.js} +11030 -9620
- package/dist/index.mjs +57 -55
- package/dist/style.css +1 -1
- package/package.json +7 -7
- package/types/components/hooks/index.d.ts +1 -0
- package/types/components/hooks/useAI.d.ts +13 -4
- package/types/components/hooks/useAgent.d.ts +17 -0
- package/types/components/hooks/useOpenApi.d.ts +2 -1
- package/types/components/regions/apps.d.ts +2 -0
- package/types/components/regions/index.d.ts +2 -0
- package/types/components/setters/image.d.ts +277 -318
- package/types/components/setters/index.d.ts +277 -318
- package/types/components/shared/binder.d.ts +313 -234
- package/types/components/shared/panel.d.ts +30 -30
- package/types/components/shared/slots.d.ts +2 -2
- package/types/components/widgets/ai/bubble.d.ts +2 -2
- package/types/components/widgets/ai/image-input.d.ts +277 -318
- package/types/components/widgets/ai/index.d.ts +15 -15
- package/types/components/widgets/ai/json-input.d.ts +558 -595
- package/types/components/widgets/apis/form.d.ts +182 -142
- package/types/components/widgets/apis/swagger.d.ts +1 -1
- package/types/components/widgets/devtools/index.d.ts +26 -26
- package/types/components/widgets/docs/index.d.ts +15 -15
- package/types/components/widgets/env/index.d.ts +1 -1
- package/types/components/widgets/i18n/index.d.ts +1 -1
- package/types/components/widgets/index.d.ts +73 -73
- package/types/components/widgets/market/index.d.ts +15 -15
- package/types/components/widgets/scripts/group.d.ts +201 -190
- package/types/components/widgets/style/spacing-input.d.ts +6 -6
- package/types/framework/ToolRegistry.d.ts +126 -0
- package/types/framework/engine.d.ts +2 -0
- package/types/framework/index.d.ts +1 -0
- package/types/framework/openapi.d.ts +9 -43
- package/types/framework/state.d.ts +6 -0
- package/types/framework/types.d.ts +95 -2
- package/types/managers/built-in/index.d.ts +1 -0
- package/types/managers/built-in/tools.d.ts +2 -0
- package/types/version.d.ts +2 -2
- package/types/wrappers/setter.d.ts +2 -2
- package/dist/Editor-CXrxSb1D.js +0 -4
- package/types/components/widgets/ai/no-file-tip.d.ts +0 -3
|
@@ -8,12 +8,12 @@ export interface Props {
|
|
|
8
8
|
}
|
|
9
9
|
declare const _default: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
10
10
|
close: (...args: any[]) => void;
|
|
11
|
-
submit: (...args: any[]) => void;
|
|
12
11
|
"update:modelValue": (...args: any[]) => void;
|
|
12
|
+
submit: (...args: any[]) => void;
|
|
13
13
|
}, string, PublicProps, Readonly<Props> & Readonly<{
|
|
14
14
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
15
|
-
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
16
15
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
16
|
+
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
17
17
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
18
18
|
bodyRef: ({
|
|
19
19
|
$: ComponentInternalInstance;
|
|
@@ -80,10 +80,10 @@ declare const _default: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsM
|
|
|
80
80
|
default: boolean;
|
|
81
81
|
};
|
|
82
82
|
width: {
|
|
83
|
-
type: (
|
|
83
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
84
84
|
};
|
|
85
85
|
height: {
|
|
86
|
-
type: (
|
|
86
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
87
87
|
};
|
|
88
88
|
flex: {
|
|
89
89
|
type: BooleanConstructor;
|
|
@@ -201,10 +201,10 @@ declare const _default: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsM
|
|
|
201
201
|
default: boolean;
|
|
202
202
|
};
|
|
203
203
|
width: {
|
|
204
|
-
type: (
|
|
204
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
205
205
|
};
|
|
206
206
|
height: {
|
|
207
|
-
type: (
|
|
207
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
208
208
|
};
|
|
209
209
|
flex: {
|
|
210
210
|
type: BooleanConstructor;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工具参数类型定义
|
|
3
|
+
*/
|
|
4
|
+
export type ToolParameterType = 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
5
|
+
/**
|
|
6
|
+
* 工具参数定义
|
|
7
|
+
*/
|
|
8
|
+
export interface ToolParameter {
|
|
9
|
+
/**
|
|
10
|
+
* 参数名称
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* 参数类型
|
|
15
|
+
*/
|
|
16
|
+
type: ToolParameterType;
|
|
17
|
+
/**
|
|
18
|
+
* 参数描述
|
|
19
|
+
*/
|
|
20
|
+
description?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 是否必需
|
|
23
|
+
*/
|
|
24
|
+
required?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 枚举值(仅适用于string类型)
|
|
27
|
+
*/
|
|
28
|
+
enum?: string[];
|
|
29
|
+
/**
|
|
30
|
+
* 对象属性定义(仅在type为'object'时使用)
|
|
31
|
+
*/
|
|
32
|
+
properties?: Record<string, Omit<ToolParameter, 'name'>>;
|
|
33
|
+
/**
|
|
34
|
+
* 数组元素类型定义(仅在type为'array'时使用)
|
|
35
|
+
*/
|
|
36
|
+
items?: Omit<ToolParameter, 'name'>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 工具定义接口
|
|
40
|
+
*/
|
|
41
|
+
export interface Tool {
|
|
42
|
+
/**
|
|
43
|
+
* 工具名称(唯一标识)
|
|
44
|
+
*/
|
|
45
|
+
name: string;
|
|
46
|
+
/**
|
|
47
|
+
* 工具描述,供大模型理解用途
|
|
48
|
+
*/
|
|
49
|
+
description: string;
|
|
50
|
+
/**
|
|
51
|
+
* 工具参数定义
|
|
52
|
+
*/
|
|
53
|
+
parameters: ToolParameter[];
|
|
54
|
+
/**
|
|
55
|
+
* 工具异步执行函数
|
|
56
|
+
*/
|
|
57
|
+
handler: (...args: any[]) => Promise<any>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 工具描述(用于大模型调用)
|
|
61
|
+
*/
|
|
62
|
+
export interface ToolDescription {
|
|
63
|
+
name: string;
|
|
64
|
+
description: string;
|
|
65
|
+
parameters: ToolParameter[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 工具注册器类,提供工具注册、查找、执行和描述生成功能
|
|
69
|
+
*/
|
|
70
|
+
export declare class ToolRegistry {
|
|
71
|
+
/**
|
|
72
|
+
* 工具存储
|
|
73
|
+
*/
|
|
74
|
+
private tools;
|
|
75
|
+
constructor();
|
|
76
|
+
/**
|
|
77
|
+
* 注册一个工具
|
|
78
|
+
* @param tool 工具定义
|
|
79
|
+
*/
|
|
80
|
+
register(tool: Tool): void;
|
|
81
|
+
/**
|
|
82
|
+
* 根据名称获取工具
|
|
83
|
+
* @param name 工具名称
|
|
84
|
+
* @returns 工具定义或undefined
|
|
85
|
+
*/
|
|
86
|
+
get(name: string): Tool | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* 修改工具配置
|
|
89
|
+
* @param name 工具名称
|
|
90
|
+
* @param tool 工具部分配置
|
|
91
|
+
*/
|
|
92
|
+
set(name: string, tool: Partial<Tool>): void;
|
|
93
|
+
/**
|
|
94
|
+
* 注销工具
|
|
95
|
+
* @param name 工具名称
|
|
96
|
+
*/
|
|
97
|
+
unregister(name: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* 获取所有工具
|
|
100
|
+
* @returns 所有已注册的工具数组
|
|
101
|
+
*/
|
|
102
|
+
getAll(): Tool[];
|
|
103
|
+
/**
|
|
104
|
+
* 检查工具是否存在且可执行
|
|
105
|
+
* @param name 工具名称
|
|
106
|
+
* @returns 是否存在
|
|
107
|
+
*/
|
|
108
|
+
has(name: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* 异步执行工具
|
|
111
|
+
* @param name 工具名称
|
|
112
|
+
* @param args 参数数组
|
|
113
|
+
* @returns 工具执行结果
|
|
114
|
+
* @throws 当工具不存在或执行出错时抛出异常
|
|
115
|
+
*/
|
|
116
|
+
execute(name: string, args?: any[]): Promise<any>;
|
|
117
|
+
/**
|
|
118
|
+
* 生成工具描述列表,供大模型使用
|
|
119
|
+
* @returns 工具描述数组
|
|
120
|
+
*/
|
|
121
|
+
generateToolDescriptions(): ToolDescription[];
|
|
122
|
+
/**
|
|
123
|
+
* 清除所有工具
|
|
124
|
+
*/
|
|
125
|
+
clear(): void;
|
|
126
|
+
}
|
|
@@ -7,6 +7,7 @@ import { Assets } from './assets';
|
|
|
7
7
|
import { Report } from './report';
|
|
8
8
|
import { OpenApi } from './openapi';
|
|
9
9
|
import { State } from './state';
|
|
10
|
+
import { ToolRegistry } from './ToolRegistry';
|
|
10
11
|
export declare const engineKey: InjectionKey<ShallowReactive<Engine>>;
|
|
11
12
|
/**
|
|
12
13
|
* 设计器引擎配置选项
|
|
@@ -124,6 +125,7 @@ export declare class Engine extends Base {
|
|
|
124
125
|
checkVersion: boolean;
|
|
125
126
|
openApi?: OpenApi;
|
|
126
127
|
state: State;
|
|
128
|
+
toolRegistry: ToolRegistry;
|
|
127
129
|
constructor(options: EngineOptions);
|
|
128
130
|
/**
|
|
129
131
|
* 初始化引擎
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PlatformType, BlockSchema } from '@vtj/core';
|
|
2
|
+
import { AITopic, AIChat } from './types';
|
|
2
3
|
export interface TemplateDto {
|
|
3
4
|
id: string;
|
|
4
5
|
name: string;
|
|
@@ -37,52 +38,13 @@ export interface TopicDto {
|
|
|
37
38
|
prompt?: string;
|
|
38
39
|
file?: File;
|
|
39
40
|
options?: string;
|
|
40
|
-
|
|
41
|
-
export type TopicType = 'text' | 'image' | 'json';
|
|
42
|
-
export type TopicDataType = 'sketch' | 'figma' | 'mastergo' | 'unknown';
|
|
43
|
-
export interface AITopic {
|
|
44
|
-
id: string;
|
|
45
|
-
appId: string;
|
|
46
|
-
createAt: string;
|
|
47
|
-
fileId: string;
|
|
48
|
-
isHot: boolean;
|
|
49
|
-
model: string;
|
|
50
|
-
platform: string;
|
|
51
|
-
projectId: string;
|
|
52
|
-
title: string;
|
|
53
|
-
prompt: string;
|
|
54
|
-
dependencies: string;
|
|
55
|
-
dsl: any;
|
|
56
|
-
image?: string;
|
|
57
|
-
json?: string;
|
|
58
|
-
type?: TopicType;
|
|
59
|
-
dataType?: TopicDataType;
|
|
60
|
-
}
|
|
61
|
-
export interface AIChat {
|
|
62
|
-
id: string;
|
|
63
|
-
content: string;
|
|
64
|
-
createdAt: string;
|
|
65
|
-
dsl: any;
|
|
66
|
-
message: string;
|
|
67
|
-
source?: string;
|
|
68
|
-
prompt: string;
|
|
69
|
-
reasoning: string;
|
|
70
|
-
status: 'Pending' | 'Success' | 'Failed' | 'Error' | 'Canceled';
|
|
71
|
-
tokens: number;
|
|
72
|
-
topicId: string;
|
|
73
|
-
userId: string;
|
|
74
|
-
userName: string;
|
|
75
|
-
thinking: number;
|
|
76
|
-
vue: string;
|
|
77
|
-
collapsed?: boolean;
|
|
78
|
-
image?: string;
|
|
79
|
-
json?: string;
|
|
80
|
-
type?: TopicType;
|
|
81
|
-
dataType?: TopicDataType;
|
|
41
|
+
tools?: string;
|
|
82
42
|
}
|
|
83
43
|
export interface ChatDto {
|
|
84
44
|
topicId: string;
|
|
85
45
|
prompt: string;
|
|
46
|
+
toolCallId?: string;
|
|
47
|
+
source?: string;
|
|
86
48
|
}
|
|
87
49
|
export interface ResponseWrapper<T = any> {
|
|
88
50
|
code: number;
|
|
@@ -223,7 +185,7 @@ export declare abstract class OpenApi {
|
|
|
223
185
|
/**
|
|
224
186
|
* 获取AI设置
|
|
225
187
|
*/
|
|
226
|
-
abstract
|
|
188
|
+
abstract getSettings?: () => Promise<Settings>;
|
|
227
189
|
/**
|
|
228
190
|
* 创建订单
|
|
229
191
|
*/
|
|
@@ -244,4 +206,8 @@ export declare abstract class OpenApi {
|
|
|
244
206
|
* 获取文件url
|
|
245
207
|
*/
|
|
246
208
|
abstract getOssFile?: (path?: string) => string | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* 获取技能文档
|
|
211
|
+
*/
|
|
212
|
+
abstract getSkills?: (platform: PlatformType, ids: string[]) => Promise<ResponseWrapper<string>>;
|
|
247
213
|
}
|
|
@@ -38,6 +38,10 @@ export interface EngineState {
|
|
|
38
38
|
* 暗黑模式
|
|
39
39
|
*/
|
|
40
40
|
dark: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* AI输出中
|
|
43
|
+
*/
|
|
44
|
+
streaming: boolean;
|
|
41
45
|
}
|
|
42
46
|
export declare class State {
|
|
43
47
|
private __state;
|
|
@@ -62,6 +66,8 @@ export declare class State {
|
|
|
62
66
|
set tour(value: boolean);
|
|
63
67
|
get dark(): boolean;
|
|
64
68
|
set dark(v: boolean);
|
|
69
|
+
get streaming(): boolean;
|
|
70
|
+
set streaming(v: boolean);
|
|
65
71
|
saveLLM(item: LLM): void;
|
|
66
72
|
removeLLM(item: LLM): void;
|
|
67
73
|
getLLMById(id: string): {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { VNode, DefineComponent } from 'vue';
|
|
2
|
-
import { BlockPropDataType } from '@vtj/core';
|
|
1
|
+
import { VNode, DefineComponent, Ref } from 'vue';
|
|
2
|
+
import { ProjectModel, Service, BlockPropDataType } from '@vtj/core';
|
|
3
|
+
import { ToolRegistry, ToolParameter } from './ToolRegistry';
|
|
4
|
+
import { Engine } from './engine';
|
|
3
5
|
export type VueComponent = Record<string, any> | VNode | DefineComponent<any, any, any, any>;
|
|
4
6
|
/**
|
|
5
7
|
* 器件分组
|
|
@@ -84,6 +86,10 @@ export interface AppWidget extends Widget {
|
|
|
84
86
|
* 链接url,openType 为 link 时有效
|
|
85
87
|
*/
|
|
86
88
|
url?: string;
|
|
89
|
+
/**
|
|
90
|
+
* 是否加缓存,openType 为 panel 有效
|
|
91
|
+
*/
|
|
92
|
+
cache?: boolean;
|
|
87
93
|
}
|
|
88
94
|
/**
|
|
89
95
|
* 选项卡类型器件
|
|
@@ -131,3 +137,90 @@ export interface Setter {
|
|
|
131
137
|
*/
|
|
132
138
|
props?: Record<string, any>;
|
|
133
139
|
}
|
|
140
|
+
export type TopicType = 'text' | 'image' | 'json';
|
|
141
|
+
export type TopicDataType = 'sketch' | 'figma' | 'mastergo' | 'unknown';
|
|
142
|
+
export interface AITopic {
|
|
143
|
+
id: string;
|
|
144
|
+
appId: string;
|
|
145
|
+
createAt: string;
|
|
146
|
+
fileId: string;
|
|
147
|
+
isHot: boolean;
|
|
148
|
+
model: string;
|
|
149
|
+
platform: string;
|
|
150
|
+
projectId: string;
|
|
151
|
+
title: string;
|
|
152
|
+
prompt: string;
|
|
153
|
+
dependencies: string;
|
|
154
|
+
dsl: any;
|
|
155
|
+
image?: string;
|
|
156
|
+
json?: string;
|
|
157
|
+
type?: TopicType;
|
|
158
|
+
dataType?: TopicDataType;
|
|
159
|
+
}
|
|
160
|
+
export interface AIChat {
|
|
161
|
+
id: string;
|
|
162
|
+
content: string;
|
|
163
|
+
createdAt: string;
|
|
164
|
+
dsl: any;
|
|
165
|
+
message: string;
|
|
166
|
+
source?: string;
|
|
167
|
+
prompt: string;
|
|
168
|
+
reasoning: string;
|
|
169
|
+
status: 'Pending' | 'Success' | 'Failed' | 'Error' | 'Canceled';
|
|
170
|
+
tokens: number;
|
|
171
|
+
topicId: string;
|
|
172
|
+
userId: string;
|
|
173
|
+
userName: string;
|
|
174
|
+
thinking: number;
|
|
175
|
+
vue: string;
|
|
176
|
+
collapsed?: boolean;
|
|
177
|
+
image?: string;
|
|
178
|
+
json?: string;
|
|
179
|
+
type?: TopicType;
|
|
180
|
+
dataType?: TopicDataType;
|
|
181
|
+
toolCallId?: string;
|
|
182
|
+
toolContent?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface AgentConfig {
|
|
185
|
+
getSkills?: (ids: string[]) => Promise<string>;
|
|
186
|
+
activeDelayMs?: number;
|
|
187
|
+
currentTopic: Ref<AITopic | null>;
|
|
188
|
+
}
|
|
189
|
+
export interface ParseResult {
|
|
190
|
+
type: 'vue' | 'diff' | 'json' | 'error';
|
|
191
|
+
label: string;
|
|
192
|
+
content: any;
|
|
193
|
+
}
|
|
194
|
+
export type ParseRule = {
|
|
195
|
+
type: 'vue';
|
|
196
|
+
label: string;
|
|
197
|
+
regex: RegExp;
|
|
198
|
+
validate: (content: string) => boolean;
|
|
199
|
+
} | {
|
|
200
|
+
type: 'diff';
|
|
201
|
+
label: string;
|
|
202
|
+
regex: RegExp;
|
|
203
|
+
validate: (content: string) => boolean;
|
|
204
|
+
} | {
|
|
205
|
+
type: 'json';
|
|
206
|
+
label: string;
|
|
207
|
+
regex: RegExp;
|
|
208
|
+
parse: (content: string) => any;
|
|
209
|
+
};
|
|
210
|
+
export interface ToolCall {
|
|
211
|
+
action: string;
|
|
212
|
+
parameters: any[];
|
|
213
|
+
}
|
|
214
|
+
export interface ToolContext {
|
|
215
|
+
engine: Engine;
|
|
216
|
+
project: ProjectModel;
|
|
217
|
+
service: Service;
|
|
218
|
+
toolRegistry: ToolRegistry;
|
|
219
|
+
config: AgentConfig;
|
|
220
|
+
}
|
|
221
|
+
export interface ToolConfig {
|
|
222
|
+
name: string;
|
|
223
|
+
description: string;
|
|
224
|
+
parameters: ToolParameter[];
|
|
225
|
+
createHandler: (context: ToolContext) => (...args: any[]) => Promise<any>;
|
|
226
|
+
}
|
package/types/version.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/designer
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.15.
|
|
5
|
+
* @version 0.15.2
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "0.15.
|
|
8
|
+
export declare const version = "0.15.2";
|
|
@@ -15,7 +15,7 @@ export declare const SetterWrapper: DefineComponent<ExtractPropTypes<{
|
|
|
15
15
|
label: StringConstructor;
|
|
16
16
|
title: StringConstructor;
|
|
17
17
|
value: {
|
|
18
|
-
type: (
|
|
18
|
+
type: (ObjectConstructor | StringConstructor | BooleanConstructor | ArrayConstructor | NumberConstructor)[];
|
|
19
19
|
default: undefined;
|
|
20
20
|
};
|
|
21
21
|
setters: {
|
|
@@ -65,7 +65,7 @@ export declare const SetterWrapper: DefineComponent<ExtractPropTypes<{
|
|
|
65
65
|
label: StringConstructor;
|
|
66
66
|
title: StringConstructor;
|
|
67
67
|
value: {
|
|
68
|
-
type: (
|
|
68
|
+
type: (ObjectConstructor | StringConstructor | BooleanConstructor | ArrayConstructor | NumberConstructor)[];
|
|
69
69
|
default: undefined;
|
|
70
70
|
};
|
|
71
71
|
setters: {
|
package/dist/Editor-CXrxSb1D.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
-
declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
3
|
-
export default _default;
|