@shenghuabi/workflow 1.1.2 → 1.1.4

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.
@@ -1,169 +1,217 @@
1
1
  import { LlmRunner } from './llm.runner';
2
2
  export declare const ChatMainConfig: {
3
3
  readonly runner: typeof LlmRunner;
4
- readonly define: import("valibot").LooseObjectSchema<{
5
- readonly data: import("valibot").LooseObjectSchema<{
6
- readonly config: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
7
- readonly llm: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").IntersectSchema<[import("valibot").SchemaWithPipe<readonly [import("valibot").IntersectSchema<[import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
8
- readonly name: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").TitleAction<string | undefined, "预定义模型配置">, import("@piying/valibot-visit").DefineTypeAction<string | undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string | undefined, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
9
- readonly model: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").TitleAction<string | undefined, "模型">]>;
10
- readonly baseURL: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").TitleAction<string | undefined, "地址">]>;
11
- }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
12
- name?: string | undefined;
13
- model?: string | undefined;
14
- baseURL?: string | undefined;
15
- }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>], undefined>, import("valibot").TitleAction<{
16
- name?: string | undefined;
17
- model?: string | undefined;
18
- baseURL?: string | undefined;
19
- }, string>, import("@piying/valibot-visit").VirtualGroupAction<{
20
- name?: string | undefined;
21
- model?: string | undefined;
22
- baseURL?: string | undefined;
23
- }>]>], undefined>, import("@piying/valibot-visit").VirtualGroupAction<{
24
- name?: string | undefined;
25
- model?: string | undefined;
26
- baseURL?: string | undefined;
27
- }>, import("@piying/valibot-visit").DefineTypeAction<{
28
- name?: string | undefined;
29
- model?: string | undefined;
30
- baseURL?: string | undefined;
31
- }>]>, undefined>;
32
- readonly responseFormat: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").PicklistSchema<readonly ["text", "json_object", "json_schema"], undefined>, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", "text" | "json_schema" | "json_object" | undefined, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("valibot").TitleAction<"text" | "json_schema" | "json_object" | undefined, "响应格式">]>;
33
- readonly parseBy: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").PicklistSchema<readonly ["json", "markdown", "yaml"], undefined>, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", "json" | "markdown" | "yaml" | undefined, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("valibot").TitleAction<"json" | "markdown" | "yaml" | undefined, "返回解析">, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", "json" | "markdown" | "yaml" | undefined, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
34
- readonly examples: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
35
- readonly input: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
36
- readonly format: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, false>, import("valibot").DescriptionAction<boolean, "选中后会尝试使用yaml解析为对象,再序列化为对应的响应类型">, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", boolean, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
37
- readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TitleAction<string, "问题">, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
38
- }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
39
- format: boolean;
40
- value: string;
41
- }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
42
- readonly output: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
43
- readonly format: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, false>, import("valibot").DescriptionAction<boolean, "是否需要格式化">, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", boolean, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
44
- readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TitleAction<string, "回答">, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
45
- }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
46
- format: boolean;
47
- value: string;
48
- }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
49
- }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
50
- input: {
51
- format: boolean;
52
- value: string;
53
- };
54
- output: {
55
- format: boolean;
56
- value: string;
57
- };
58
- }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>, undefined>, readonly []>, import("valibot").TitleAction<{
59
- input: {
60
- format: boolean;
61
- value: string;
62
- };
63
- output: {
64
- format: boolean;
65
- value: string;
66
- };
67
- }[], "用例">, import("valibot").DescriptionAction<{
68
- input: {
69
- format: boolean;
70
- value: string;
71
- };
72
- output: {
73
- format: boolean;
74
- value: string;
75
- };
76
- }[], "回答问题之前,会参考定义的用例格式进行回复,用于规范回答">]>;
4
+ readonly define: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
5
+ readonly llm: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").IntersectSchema<[import("valibot").SchemaWithPipe<readonly [import("valibot").IntersectSchema<[import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
6
+ readonly name: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").TitleAction<string | undefined, "预定义模型配置">, import("@piying/valibot-visit").DefineTypeAction<string | undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string | undefined, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
7
+ readonly model: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").TitleAction<string | undefined, "模型">]>;
8
+ readonly baseURL: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").TitleAction<string | undefined, "地址">]>;
9
+ }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
10
+ name?: string | undefined;
11
+ model?: string | undefined;
12
+ baseURL?: string | undefined;
13
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>], undefined>, import("valibot").TitleAction<{
14
+ name?: string | undefined;
15
+ model?: string | undefined;
16
+ baseURL?: string | undefined;
17
+ }, string>, import("@piying/valibot-visit").VirtualGroupAction<{
18
+ name?: string | undefined;
19
+ model?: string | undefined;
20
+ baseURL?: string | undefined;
21
+ }>]>], undefined>, import("@piying/valibot-visit").VirtualGroupAction<{
22
+ name?: string | undefined;
23
+ model?: string | undefined;
24
+ baseURL?: string | undefined;
25
+ }>, import("@piying/valibot-visit").DefineTypeAction<{
26
+ name?: string | undefined;
27
+ model?: string | undefined;
28
+ baseURL?: string | undefined;
29
+ }>]>, undefined>;
30
+ readonly responseFormat: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").PicklistSchema<readonly ["text", "json_object", "json_schema"], undefined>, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", "text" | "json_schema" | "json_object" | undefined, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("valibot").TitleAction<"text" | "json_schema" | "json_object" | undefined, "响应格式">]>;
31
+ readonly parseBy: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").PicklistSchema<readonly ["json", "markdown", "yaml"], undefined>, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", "json" | "markdown" | "yaml" | undefined, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("valibot").TitleAction<"json" | "markdown" | "yaml" | undefined, "返回解析">, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", "json" | "markdown" | "yaml" | undefined, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
32
+ readonly examples: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
33
+ readonly input: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
34
+ readonly format: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, false>, import("valibot").DescriptionAction<boolean, "选中后会尝试使用yaml解析为对象,再序列化为对应的响应类型">, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", boolean, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
35
+ readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TitleAction<string, "问题">, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
77
36
  }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
78
- llm?: {
79
- name?: string | undefined;
80
- model?: string | undefined;
81
- baseURL?: string | undefined;
82
- } | undefined;
83
- responseFormat?: "text" | "json_schema" | "json_object" | undefined;
84
- parseBy?: "json" | "markdown" | "yaml" | undefined;
85
- examples: {
86
- input: {
87
- format: boolean;
88
- value: string;
89
- };
90
- output: {
91
- format: boolean;
92
- value: string;
93
- };
94
- }[];
95
- }, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
96
- llm?: {
97
- name?: string | undefined;
98
- model?: string | undefined;
99
- baseURL?: string | undefined;
100
- } | undefined;
101
- responseFormat?: "text" | "json_schema" | "json_object" | undefined;
102
- parseBy?: "json" | "markdown" | "yaml" | undefined;
103
- examples: {
104
- input: {
105
- format: boolean;
106
- value: string;
107
- };
108
- output: {
109
- format: boolean;
110
- value: string;
111
- };
112
- }[];
37
+ format: boolean;
38
+ value: string;
113
39
  }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
114
- readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").CustomSchema<({
115
- role: "system";
116
- content: {
117
- text: string;
118
- type: "text";
119
- }[];
40
+ readonly output: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
41
+ readonly format: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, false>, import("valibot").DescriptionAction<boolean, "是否需要格式化">, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", boolean, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
42
+ readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TitleAction<string, "回答">, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
43
+ }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
44
+ format: boolean;
45
+ value: string;
46
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
47
+ }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
48
+ input: {
49
+ format: boolean;
50
+ value: string;
51
+ };
52
+ output: {
53
+ format: boolean;
54
+ value: string;
55
+ };
56
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>, undefined>, readonly []>, import("valibot").TitleAction<{
57
+ input: {
58
+ format: boolean;
59
+ value: string;
60
+ };
61
+ output: {
62
+ format: boolean;
63
+ value: string;
64
+ };
65
+ }[], "用例">, import("valibot").DescriptionAction<{
66
+ input: {
67
+ format: boolean;
68
+ value: string;
69
+ };
70
+ output: {
71
+ format: boolean;
72
+ value: string;
73
+ };
74
+ }[], "回答问题之前,会参考定义的用例格式进行回复,用于规范回答">]>;
75
+ readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").CustomSchema<({
76
+ role: "system";
77
+ content: {
78
+ text: string;
79
+ type: "text";
80
+ }[];
81
+ } | {
82
+ role: "user";
83
+ content: ({
84
+ text: string;
85
+ type: "text";
120
86
  } | {
121
- role: "user";
122
- content: ({
123
- text: string;
124
- type: "text";
125
- } | {
126
- image_url: {
127
- url: string;
128
- detail?: "auto" | "low" | "high" | undefined;
129
- };
130
- type: "image_url";
131
- })[];
87
+ image_url: {
88
+ url: string;
89
+ detail?: "auto" | "low" | "high" | undefined;
90
+ };
91
+ type: "image_url";
92
+ })[];
93
+ } | {
94
+ role: "assistant";
95
+ content: {
96
+ text: string;
97
+ type: "text";
98
+ }[];
99
+ thinkContent?: string | undefined;
100
+ })[], undefined>, import("@piying/valibot-visit").DefineTypeAction<({
101
+ role: "system";
102
+ content: {
103
+ text: string;
104
+ type: "text";
105
+ }[];
106
+ } | {
107
+ role: "user";
108
+ content: ({
109
+ text: string;
110
+ type: "text";
132
111
  } | {
133
- role: "assistant";
134
- content: {
135
- text: string;
136
- type: "text";
137
- }[];
138
- thinkContent?: string | undefined;
139
- })[], undefined>, import("@piying/valibot-visit").DefineTypeAction<({
140
- role: "system";
141
- content: {
142
- text: string;
143
- type: "text";
144
- }[];
112
+ image_url: {
113
+ url: string;
114
+ detail?: "auto" | "low" | "high" | undefined;
115
+ };
116
+ type: "image_url";
117
+ })[];
118
+ } | {
119
+ role: "assistant";
120
+ content: {
121
+ text: string;
122
+ type: "text";
123
+ }[];
124
+ thinkContent?: string | undefined;
125
+ })[]>]>;
126
+ }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
127
+ llm?: {
128
+ name?: string | undefined;
129
+ model?: string | undefined;
130
+ baseURL?: string | undefined;
131
+ } | undefined;
132
+ responseFormat?: "text" | "json_schema" | "json_object" | undefined;
133
+ parseBy?: "json" | "markdown" | "yaml" | undefined;
134
+ examples: {
135
+ input: {
136
+ format: boolean;
137
+ value: string;
138
+ };
139
+ output: {
140
+ format: boolean;
141
+ value: string;
142
+ };
143
+ }[];
144
+ value: ({
145
+ role: "system";
146
+ content: {
147
+ text: string;
148
+ type: "text";
149
+ }[];
150
+ } | {
151
+ role: "user";
152
+ content: ({
153
+ text: string;
154
+ type: "text";
145
155
  } | {
146
- role: "user";
147
- content: ({
148
- text: string;
149
- type: "text";
150
- } | {
151
- image_url: {
152
- url: string;
153
- detail?: "auto" | "low" | "high" | undefined;
154
- };
155
- type: "image_url";
156
- })[];
156
+ image_url: {
157
+ url: string;
158
+ detail?: "auto" | "low" | "high" | undefined;
159
+ };
160
+ type: "image_url";
161
+ })[];
162
+ } | {
163
+ role: "assistant";
164
+ content: {
165
+ text: string;
166
+ type: "text";
167
+ }[];
168
+ thinkContent?: string | undefined;
169
+ })[];
170
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
171
+ llm?: {
172
+ name?: string | undefined;
173
+ model?: string | undefined;
174
+ baseURL?: string | undefined;
175
+ } | undefined;
176
+ responseFormat?: "text" | "json_schema" | "json_object" | undefined;
177
+ parseBy?: "json" | "markdown" | "yaml" | undefined;
178
+ examples: {
179
+ input: {
180
+ format: boolean;
181
+ value: string;
182
+ };
183
+ output: {
184
+ format: boolean;
185
+ value: string;
186
+ };
187
+ }[];
188
+ value: ({
189
+ role: "system";
190
+ content: {
191
+ text: string;
192
+ type: "text";
193
+ }[];
194
+ } | {
195
+ role: "user";
196
+ content: ({
197
+ text: string;
198
+ type: "text";
157
199
  } | {
158
- role: "assistant";
159
- content: {
160
- text: string;
161
- type: "text";
162
- }[];
163
- thinkContent?: string | undefined;
164
- })[]>]>;
165
- }, undefined>;
166
- }, undefined>;
200
+ image_url: {
201
+ url: string;
202
+ detail?: "auto" | "low" | "high" | undefined;
203
+ };
204
+ type: "image_url";
205
+ })[];
206
+ } | {
207
+ role: "assistant";
208
+ content: {
209
+ text: string;
210
+ type: "text";
211
+ }[];
212
+ thinkContent?: string | undefined;
213
+ })[];
214
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
167
215
  readonly afterAdd?: (node: import("../../../..").CustomNode, injector: import("static-injector").Injector) => any;
168
216
  readonly priority?: number;
169
217
  readonly type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shenghuabi/workflow",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "模板",
5
5
  "author": "wszgrcy",
6
6
  "sideEffects": false,
@@ -11,7 +11,7 @@
11
11
  "@cyia/external-call": "^1.5.2",
12
12
  "@cyia/util": "^1.5.2",
13
13
  "@cyia/vfs2": "^1.5.2",
14
- "@shenghuabi/openai": "1.1.2",
14
+ "@shenghuabi/openai": "1.1.4",
15
15
  "static-injector": "^6.1.2",
16
16
  "@piying/view-angular-core": "^2.9.3",
17
17
  "@piying/valibot-visit": "^1.3.11"
package/share/type.d.ts CHANGED
@@ -52,7 +52,6 @@ export type CustomNode<T extends Record<string, any> = Record<string, any>> = No
52
52
  style?: Record<string, any>;
53
53
  handle?: {
54
54
  /** 0 必须是连接点,否则空掉,1必须是value,否则空掉,之后随意 */
55
- input: HandleNode[][];
56
55
  output: HandleNode[][];
57
56
  };
58
57
  minSize?: {
package/webview/index.js CHANGED
@@ -152,119 +152,80 @@ var RUNNER_ORIGIN_OUTPUT_KEY = `[Origin]`;
152
152
  // packages/workflow/inline/node/chat/chat.node.define.ts
153
153
  var ResponseList = ["json", "markdown", "yaml"];
154
154
  var ResponseFormat = ["text", "json_object", "json_schema"];
155
- var CHAT_NODE_DEFINE = v3.looseObject({
156
- data: v3.looseObject({
157
- config: v3.pipe(
158
- v3.object({
159
- llm: v3.optional(llmModelConfig()),
160
- /** 处理时解析 */
161
- responseFormat: v3.pipe(
162
- v3.optional(v3.picklist(ResponseFormat)),
163
- import_view_angular_core4.actions.inputs.patch({
164
- options: [
165
- // 有输入json时
166
- {
167
- label: "自动",
168
- value: void 0,
169
- description: `传入JsonSchema时为[json_schema],否则为[text]`
170
- },
171
- { label: "文本", value: "text" },
172
- {
173
- label: "JSON对象",
174
- value: "json_object",
175
- description: "只限制返回类型为JSON对象,不对字段进行限制"
176
- },
177
- {
178
- label: "JSON格式定义",
179
- value: "json_schema",
180
- description: "限制返回类型为JSON对象,同时限制字段,不建议手动指定,传入JsonSchema后自动启用"
181
- }
182
- ]
183
- }),
184
- v3.title("响应格式")
185
- ),
186
- /** 处理后解析 */
187
- parseBy: v3.pipe(
188
- v3.optional(v3.picklist(ResponseList)),
189
- import_view_angular_core4.actions.inputs.patch({
190
- options: [
191
- { label: "直接返回", value: void 0 },
192
- {
193
- label: "json",
194
- value: "json",
195
- description: `将返回的json代码块内容或原始内容解析为对象`
196
- },
197
- {
198
- label: "markdown",
199
- value: "markdown",
200
- description: `[需要提示词约束]将返回其中的markdown代码块内容或原始内容`
201
- },
202
- {
203
- label: "yaml",
204
- value: "yaml",
205
- description: `[需要提示词约束]将返回的yaml代码块内容或原始内容解析为对象`
206
- }
207
- ]
208
- }),
209
- v3.title("返回解析"),
210
- (0, import_view_angular_core4.valueChange)((fn) => {
211
- fn({ list: [["..", "responseFormat"]] }).subscribe(
212
- ({ list: [value], field }) => {
213
- if ((value ?? "").startsWith("json")) {
214
- if (!field.form.control.value) {
215
- field.form.control.updateValue("json");
216
- }
217
- }
218
- }
219
- );
220
- })
221
- ),
222
- examples: EXAMPLES_DEFINE
155
+ var CHAT_NODE_DEFINE = v3.pipe(
156
+ v3.object({
157
+ llm: v3.optional(llmModelConfig()),
158
+ /** 处理时解析 */
159
+ responseFormat: v3.pipe(
160
+ v3.optional(v3.picklist(ResponseFormat)),
161
+ import_view_angular_core4.actions.inputs.patch({
162
+ options: [
163
+ // 有输入json时
164
+ {
165
+ label: "自动",
166
+ value: void 0,
167
+ description: `传入JsonSchema时为[json_schema],否则为[text]`
168
+ },
169
+ { label: "文本", value: "text" },
170
+ {
171
+ label: "JSON对象",
172
+ value: "json_object",
173
+ description: "只限制返回类型为JSON对象,不对字段进行限制"
174
+ },
175
+ {
176
+ label: "JSON格式定义",
177
+ value: "json_schema",
178
+ description: "限制返回类型为JSON对象,同时限制字段,不建议手动指定,传入JsonSchema后自动启用"
179
+ }
180
+ ]
181
+ }),
182
+ v3.title("响应格式")
183
+ ),
184
+ /** 处理后解析 */
185
+ parseBy: v3.pipe(
186
+ v3.optional(v3.picklist(ResponseList)),
187
+ import_view_angular_core4.actions.inputs.patch({
188
+ options: [
189
+ { label: "直接返回", value: void 0 },
190
+ {
191
+ label: "json",
192
+ value: "json",
193
+ description: `将返回的json代码块内容或原始内容解析为对象`
194
+ },
195
+ {
196
+ label: "markdown",
197
+ value: "markdown",
198
+ description: `[需要提示词约束]将返回其中的markdown代码块内容或原始内容`
199
+ },
200
+ {
201
+ label: "yaml",
202
+ value: "yaml",
203
+ description: `[需要提示词约束]将返回的yaml代码块内容或原始内容解析为对象`
204
+ }
205
+ ]
223
206
  }),
224
- import_view_angular_core4.actions.wrappers.patch(["div"]),
225
- import_view_angular_core4.actions.class.top("grid auto-rows-auto gap-2")
207
+ v3.title("返回解析"),
208
+ (0, import_view_angular_core4.valueChange)((fn) => {
209
+ fn({ list: [["..", "responseFormat"]] }).subscribe(
210
+ ({ list: [value], field }) => {
211
+ if ((value ?? "").startsWith("json")) {
212
+ if (!field.form.control.value) {
213
+ field.form.control.updateValue("json");
214
+ }
215
+ }
216
+ }
217
+ );
218
+ })
226
219
  ),
220
+ examples: EXAMPLES_DEFINE,
227
221
  value: v3.pipe(
228
222
  v3.custom(Boolean),
229
223
  (0, import_view_angular_core4.setComponent)("prompt-list")
230
- // valueChange((fn) => {
231
- // fn({ list: [undefined] }).subscribe(({ list: [value], field }) => {
232
- // if (!Array.isArray(value)) {
233
- // return;
234
- // }
235
- // const inputValue: ChatMessageListInputType = value ?? [];
236
- // // field.context
237
- // // .parseTemplate(
238
- // // inputValue.flatMap((item) =>
239
- // // item.content.map((item) =>
240
- // // item.type === 'text' ? item.text : '',
241
- // // ),
242
- // // ),
243
- // // )
244
- // // .then((value: any) => {
245
- // // if (!value) {
246
- // // return;
247
- // // }
248
- // // field.context.changeHandleData(field, 'input', 1, value);
249
- // // });
250
- // // const list = inputValue
251
- // // .flatMap((item) =>
252
- // // item.content.map((item) =>
253
- // // item.type === 'image_url' ? item.image_url.url : undefined,
254
- // // ),
255
- // // )
256
- // // .filter(Boolean)
257
- // // .map((item) => ({
258
- // // value: `${item}`,
259
- // // label: `${item}`,
260
- // // inputType: `image` as const,
261
- // // }));
262
- // // field.context.changeHandleData(field, 'input', 3, list ?? []);
263
- // });
264
- // }),
265
224
  )
266
- })
267
- });
225
+ }),
226
+ import_view_angular_core4.actions.wrappers.patch(["div"]),
227
+ import_view_angular_core4.actions.class.top("grid auto-rows-auto gap-2")
228
+ );
268
229
 
269
230
  // packages/workflow/share/const.ts
270
231
  var HelpObj = {