@vertesia/ui 0.64.0 → 0.65.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/lib/esm/core/components/shadcn/selectBox.js +1 -1
- package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
- package/lib/esm/env/index.js +4 -1
- package/lib/esm/env/index.js.map +1 -1
- package/lib/esm/features/agent/PayloadBuilder.js +29 -16
- package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +2 -6
- package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/esm/features/magic-pdf/PdfPageProvider.js +3 -3
- package/lib/esm/features/magic-pdf/PdfPageProvider.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/env/index.d.ts +1 -0
- package/lib/types/features/agent/PayloadBuilder.d.ts +5 -2
- package/lib/vertesia-ui-core.js +1 -1
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +1 -1
- package/lib/vertesia-ui-features.js.map +1 -1
- package/package.json +6 -4
- package/src/core/components/shadcn/selectBox.tsx +1 -1
- package/src/env/index.ts +5 -1
- package/src/features/agent/PayloadBuilder.tsx +33 -16
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +0 -11
- package/src/features/magic-pdf/PdfPageProvider.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.0",
|
|
4
4
|
"description": "Vertesia UI components and and hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -55,9 +55,10 @@
|
|
|
55
55
|
"remark-gfm": "^4.0.1",
|
|
56
56
|
"tailwind-merge": "^3.3.0",
|
|
57
57
|
"ts-md5": "^1.3.1",
|
|
58
|
-
"
|
|
59
|
-
"@vertesia/
|
|
60
|
-
"@vertesia/
|
|
58
|
+
"json-schema": "^0.4.0",
|
|
59
|
+
"@vertesia/client": "0.65.0",
|
|
60
|
+
"@vertesia/common": "0.65.0",
|
|
61
|
+
"@vertesia/json": "0.65.0"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
64
|
"@eslint/js": "^9.27.0",
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"@types/node": "^22.15.21",
|
|
69
70
|
"@types/react": "^19.1.0",
|
|
70
71
|
"@types/react-dom": "^19.1.1",
|
|
72
|
+
"@types/json-schema": "^7.0.15",
|
|
71
73
|
"eslint": "^9.27.0",
|
|
72
74
|
"eslint-import-resolver-typescript": "^4.3.5",
|
|
73
75
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -179,7 +179,7 @@ export function VSelectBox<T = any>({ options, optionLabel, value, onChange, add
|
|
|
179
179
|
className,
|
|
180
180
|
border && 'border border-border',
|
|
181
181
|
'flex flex-row gap-2 items-center justify-between p-2 rounded-md group relative',
|
|
182
|
-
!disabled
|
|
182
|
+
!disabled ? "cursor-pointer hover:bg-muted" : "cursor-not-allowed text-muted",
|
|
183
183
|
)}
|
|
184
184
|
>
|
|
185
185
|
<div
|
package/src/env/index.ts
CHANGED
|
@@ -64,8 +64,12 @@ export class VertesiaEnvironment implements Readonly<EnvProps> {
|
|
|
64
64
|
return this.type === "production";
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
get isStable() {
|
|
68
|
+
return this.type === "production" || this.type === "preview" || this.type === "dr";
|
|
69
|
+
}
|
|
70
|
+
|
|
67
71
|
get isDev() {
|
|
68
|
-
return !this.
|
|
72
|
+
return !this.isStable;
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
get isPreview() {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AsyncExecutionResult, VertesiaClient } from "@vertesia/client";
|
|
2
|
-
import { ExecutionEnvironmentRef, Interaction,
|
|
2
|
+
import { ExecutionEnvironmentRef, Interaction, mergePromptsSchema, PopulatedInteraction, supportsToolUse } from "@vertesia/common";
|
|
3
3
|
import { JSONObject } from "@vertesia/json";
|
|
4
4
|
import { useUserSession } from "@vertesia/ui/session";
|
|
5
5
|
import Ajv, { ValidateFunction } from "ajv";
|
|
6
6
|
import React, { createContext, useContext, useEffect, useState } from "react";
|
|
7
|
+
import type { JSONSchema4 } from "json-schema";
|
|
7
8
|
|
|
8
9
|
export interface ConversationWorkflowPayload {
|
|
9
10
|
interaction?: Interaction | undefined;
|
|
@@ -18,10 +19,10 @@ export class PayloadBuilder implements ConversationWorkflowPayload {
|
|
|
18
19
|
_start: boolean = false;
|
|
19
20
|
|
|
20
21
|
payload: ConversationWorkflowPayload;
|
|
21
|
-
|
|
22
|
+
private _interactionParamsSchema?: JSONSchema4 | null;
|
|
22
23
|
private _inputValidator?: {
|
|
23
24
|
validate: ValidateFunction;
|
|
24
|
-
schema:
|
|
25
|
+
schema: JSONSchema4;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
constructor(public vertesia: VertesiaClient, public updateState: (data: PayloadBuilder) => void) {
|
|
@@ -32,12 +33,13 @@ export class PayloadBuilder implements ConversationWorkflowPayload {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
onStateChanged() {
|
|
35
|
-
this.
|
|
36
|
+
const newInstance = this.clone();
|
|
37
|
+
this.updateState(newInstance);
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
clone() {
|
|
39
41
|
const builder = new PayloadBuilder(this.vertesia, this.updateState);
|
|
40
|
-
builder.
|
|
42
|
+
builder._interactionParamsSchema = this._interactionParamsSchema;
|
|
41
43
|
builder.payload = this.payload;
|
|
42
44
|
builder._interactive = this._interactive;
|
|
43
45
|
builder._inputValidator = this._inputValidator;
|
|
@@ -61,15 +63,10 @@ export class PayloadBuilder implements ConversationWorkflowPayload {
|
|
|
61
63
|
set interaction(interaction: Interaction | undefined) {
|
|
62
64
|
if (interaction?.id !== this.payload.interaction?.id) {
|
|
63
65
|
this.payload.interaction = interaction;
|
|
64
|
-
this.
|
|
66
|
+
this._interactionParamsSchema = mergePromptsSchema(this.interaction as PopulatedInteraction) as JSONSchema4;
|
|
65
67
|
// Reset the validator when schema changes
|
|
66
68
|
this._inputValidator = undefined;
|
|
67
69
|
if (interaction) {
|
|
68
|
-
if (interaction.model) {
|
|
69
|
-
this.payload.model = interaction.model;
|
|
70
|
-
} else {
|
|
71
|
-
this.payload.model = undefined;
|
|
72
|
-
}
|
|
73
70
|
if (interaction.environment) {
|
|
74
71
|
if (typeof interaction.environment === 'string') {
|
|
75
72
|
this.vertesia.environments.retrieve(interaction.environment).then((environment) => this.environment = environment);
|
|
@@ -77,6 +74,12 @@ export class PayloadBuilder implements ConversationWorkflowPayload {
|
|
|
77
74
|
this.payload.environment = interaction.environment;
|
|
78
75
|
}
|
|
79
76
|
}
|
|
77
|
+
if (interaction.model) {
|
|
78
|
+
this.payload.model = interaction.model;
|
|
79
|
+
} else {
|
|
80
|
+
this.payload.model = this.environment?.default_model && supportsToolUse(this.environment.default_model, this.environment.provider)
|
|
81
|
+
? this.environment.default_model : undefined;
|
|
82
|
+
}
|
|
80
83
|
}
|
|
81
84
|
this.onStateChanged();
|
|
82
85
|
}
|
|
@@ -88,6 +91,9 @@ export class PayloadBuilder implements ConversationWorkflowPayload {
|
|
|
88
91
|
set environment(environment: ExecutionEnvironmentRef | undefined) {
|
|
89
92
|
if (environment?.id !== this.payload.environment?.id) {
|
|
90
93
|
this.payload.environment = environment;
|
|
94
|
+
this.payload.model = environment?.default_model && supportsToolUse(environment.default_model, environment.provider)
|
|
95
|
+
? environment.default_model : undefined;
|
|
96
|
+
|
|
91
97
|
this.onStateChanged();
|
|
92
98
|
}
|
|
93
99
|
}
|
|
@@ -134,6 +140,17 @@ export class PayloadBuilder implements ConversationWorkflowPayload {
|
|
|
134
140
|
return this._start;
|
|
135
141
|
}
|
|
136
142
|
|
|
143
|
+
get interactionParamsSchema(): JSONSchema4 | null | undefined {
|
|
144
|
+
return this._interactionParamsSchema;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
set interactionParamsSchema(schema: JSONSchema4 | null | undefined) {
|
|
148
|
+
if (this._interactionParamsSchema !== schema) {
|
|
149
|
+
this._interactionParamsSchema = schema;
|
|
150
|
+
this.onStateChanged();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
137
154
|
reset() {
|
|
138
155
|
this._start = false;
|
|
139
156
|
this._interactive = true;
|
|
@@ -144,7 +161,7 @@ export class PayloadBuilder implements ConversationWorkflowPayload {
|
|
|
144
161
|
environment: undefined,
|
|
145
162
|
prompt_data: undefined
|
|
146
163
|
};
|
|
147
|
-
this.
|
|
164
|
+
this._interactionParamsSchema = null;
|
|
148
165
|
this._inputValidator = undefined;
|
|
149
166
|
|
|
150
167
|
this.onStateChanged();
|
|
@@ -156,16 +173,16 @@ export class PayloadBuilder implements ConversationWorkflowPayload {
|
|
|
156
173
|
}
|
|
157
174
|
|
|
158
175
|
validateInput(): { isValid: boolean; errorMessage?: string } {
|
|
159
|
-
if (!this.
|
|
176
|
+
if (!this._interactionParamsSchema) {
|
|
160
177
|
return { isValid: true };
|
|
161
178
|
}
|
|
162
179
|
|
|
163
180
|
// If schema has changed or validator not initialized, recompile
|
|
164
|
-
if (!this._inputValidator || this._inputValidator.schema !== this.
|
|
181
|
+
if (!this._inputValidator || this._inputValidator.schema !== this._interactionParamsSchema) {
|
|
165
182
|
const ajv = new Ajv({ strict: false });
|
|
166
183
|
this._inputValidator = {
|
|
167
|
-
validate: ajv.compile(this.
|
|
168
|
-
schema: this.
|
|
184
|
+
validate: ajv.compile(this._interactionParamsSchema),
|
|
185
|
+
schema: this._interactionParamsSchema
|
|
169
186
|
};
|
|
170
187
|
}
|
|
171
188
|
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
DownloadCloudIcon,
|
|
9
9
|
ExternalLink,
|
|
10
10
|
MoreVertical,
|
|
11
|
-
Plus,
|
|
12
11
|
XIcon,
|
|
13
12
|
} from "lucide-react";
|
|
14
13
|
import { PayloadBuilderProvider, usePayloadBuilder } from "../../PayloadBuilder";
|
|
@@ -148,11 +147,6 @@ function MoreDropdown({
|
|
|
148
147
|
}
|
|
149
148
|
};
|
|
150
149
|
|
|
151
|
-
const startNewAgent = () => {
|
|
152
|
-
builder.reset();
|
|
153
|
-
resetWorkflow?.();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
150
|
const openUrl = (url: string) => {
|
|
157
151
|
window.open(url, "_blank");
|
|
158
152
|
return url;
|
|
@@ -215,11 +209,6 @@ function MoreDropdown({
|
|
|
215
209
|
}}>
|
|
216
210
|
<XIcon className="size-3.5 mr-2 text-destructive" /> Cancel Workflow
|
|
217
211
|
</CommandItem>
|
|
218
|
-
{!isModal && (
|
|
219
|
-
<CommandItem className="text-xs" onSelect={startNewAgent}>
|
|
220
|
-
<Plus className="size-3.5 mr-2 text-muted" /> Start a new Agent
|
|
221
|
-
</CommandItem>
|
|
222
|
-
)}
|
|
223
212
|
</CommandGroup>
|
|
224
213
|
</CommandList>
|
|
225
214
|
</Command>
|
|
@@ -83,14 +83,14 @@ function getBasePath(objectId: string) {
|
|
|
83
83
|
return `${ADVANCED_PROCESSING_PREFIX}/${objectId}`;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function getPageImagePath(objectId: string, pageNumber: number, ext = ".
|
|
86
|
+
function getPageImagePath(objectId: string, pageNumber: number, ext = ".jpg") {
|
|
87
87
|
return `${getBasePath(objectId)}/pages/page-${pageNumber}${ext}`;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function getPageAnnotatedImagePath(
|
|
91
91
|
objectId: string,
|
|
92
92
|
pageNumber: number,
|
|
93
|
-
ext = ".
|
|
93
|
+
ext = ".jpg",
|
|
94
94
|
) {
|
|
95
95
|
return `${getBasePath(objectId)}/pages/page-${pageNumber}-annotated${ext}`;
|
|
96
96
|
}
|
|
@@ -98,7 +98,7 @@ function getPageAnnotatedImagePath(
|
|
|
98
98
|
function getPageInstrumentedImagePath(
|
|
99
99
|
objectId: string,
|
|
100
100
|
pageNumber: number,
|
|
101
|
-
ext = ".
|
|
101
|
+
ext = ".jpg",
|
|
102
102
|
) {
|
|
103
103
|
return `${getBasePath(objectId)}/pages/page-${pageNumber}.instrumented${ext}`;
|
|
104
104
|
}
|