veryfront 0.1.437 → 0.1.439
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/esm/deno.js +1 -1
- package/esm/extensions/ext-anthropic/src/anthropic-provider.d.ts.map +1 -1
- package/esm/extensions/ext-anthropic/src/anthropic-provider.js +23 -5
- package/esm/extensions/ext-google/src/google-provider.d.ts.map +1 -1
- package/esm/extensions/ext-google/src/google-provider.js +22 -2
- package/esm/extensions/ext-openai/src/openai-provider.d.ts.map +1 -1
- package/esm/extensions/ext-openai/src/openai-provider.js +23 -2
- package/esm/src/agent/runtime/provider-tool-compat.d.ts.map +1 -1
- package/esm/src/agent/runtime/provider-tool-compat.js +3 -0
- package/esm/src/agent/runtime/text-generation-runtime-message-converter.d.ts.map +1 -1
- package/esm/src/agent/runtime/text-generation-runtime-message-converter.js +38 -2
- package/esm/src/agent/runtime/text-generation-runtime-message-types.d.ts +7 -1
- package/esm/src/agent/runtime/text-generation-runtime-message-types.d.ts.map +1 -1
- package/esm/src/agent/runtime-message-file-url-refresh.d.ts.map +1 -1
- package/esm/src/agent/runtime-message-file-url-refresh.js +64 -10
- package/esm/src/chat/conversation.d.ts.map +1 -1
- package/esm/src/chat/conversation.js +8 -5
- package/esm/src/provider/runtime-loader.d.ts +14 -1
- package/esm/src/provider/runtime-loader.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader.js +19 -1
- package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
- package/esm/src/runtime/runtime-bridge.js +3 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/deps/esm.sh/@types/react-dom@19.2.3/client.d.ts +1 -1
- package/src/deps/esm.sh/@types/{react@19.2.14 → react@19.2.3}/global.d.ts +0 -1
- package/src/deps/esm.sh/@types/{react@19.2.14 → react@19.2.3}/index.d.ts +24 -93
- package/src/deps/esm.sh/react-dom@19.2.4/client.d.ts +1 -1
- package/src/extensions/ext-anthropic/src/anthropic-provider.ts +28 -5
- package/src/extensions/ext-google/src/google-provider.ts +27 -2
- package/src/extensions/ext-openai/src/openai-provider.ts +29 -2
- package/src/src/agent/runtime/provider-tool-compat.ts +4 -0
- package/src/src/agent/runtime/text-generation-runtime-message-converter.ts +41 -2
- package/src/src/agent/runtime/text-generation-runtime-message-types.ts +8 -1
- package/src/src/agent/runtime-message-file-url-refresh.ts +78 -12
- package/src/src/chat/conversation.ts +15 -9
- package/src/src/provider/runtime-loader.ts +46 -3
- package/src/src/runtime/runtime-bridge.ts +10 -2
- package/src/src/utils/version-constant.ts +1 -1
|
@@ -34,7 +34,13 @@ export type { RuntimeUsage };
|
|
|
34
34
|
|
|
35
35
|
export type RuntimePromptMessage =
|
|
36
36
|
| { role: "system"; content: string }
|
|
37
|
-
| {
|
|
37
|
+
| {
|
|
38
|
+
role: "user";
|
|
39
|
+
content: Array<
|
|
40
|
+
| { type: "text"; text: string }
|
|
41
|
+
| { type: "image" | "file"; mediaType: string; url: string; filename?: string }
|
|
42
|
+
>;
|
|
43
|
+
}
|
|
38
44
|
| {
|
|
39
45
|
role: "assistant";
|
|
40
46
|
content: Array<
|
|
@@ -261,7 +267,15 @@ type OpenAICompatibleLanguageOptions = {
|
|
|
261
267
|
};
|
|
262
268
|
export type OpenAICompatibleChatMessage =
|
|
263
269
|
| { role: "system"; content: string }
|
|
264
|
-
| {
|
|
270
|
+
| {
|
|
271
|
+
role: "user";
|
|
272
|
+
content:
|
|
273
|
+
| string
|
|
274
|
+
| Array<
|
|
275
|
+
| { type: "text"; text: string }
|
|
276
|
+
| { type: "image_url"; image_url: { url: string } }
|
|
277
|
+
>;
|
|
278
|
+
}
|
|
265
279
|
| {
|
|
266
280
|
role: "assistant";
|
|
267
281
|
content: string | null;
|
|
@@ -279,6 +293,11 @@ export type OpenAICompatibleChatMessage =
|
|
|
279
293
|
tool_call_id: string;
|
|
280
294
|
content: string;
|
|
281
295
|
};
|
|
296
|
+
type RuntimePromptUserContent = Extract<RuntimePromptMessage, { role: "user" }>["content"];
|
|
297
|
+
type OpenAICompatibleUserContent = Extract<
|
|
298
|
+
OpenAICompatibleChatMessage,
|
|
299
|
+
{ role: "user" }
|
|
300
|
+
>["content"];
|
|
282
301
|
export type OpenAICompatibleChatRequest = {
|
|
283
302
|
model: string;
|
|
284
303
|
messages: OpenAICompatibleChatMessage[];
|
|
@@ -359,6 +378,30 @@ export function readTextParts(parts: Array<{ type: string; text?: string }>): st
|
|
|
359
378
|
return text;
|
|
360
379
|
}
|
|
361
380
|
|
|
381
|
+
function toOpenAICompatibleUserContent(
|
|
382
|
+
parts: RuntimePromptUserContent,
|
|
383
|
+
): OpenAICompatibleUserContent {
|
|
384
|
+
if (!parts.some((part) => part.type !== "text" && part.mediaType.startsWith("image/"))) {
|
|
385
|
+
return readTextParts(parts);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const content: Exclude<OpenAICompatibleUserContent, string> = [];
|
|
389
|
+
|
|
390
|
+
for (const part of parts) {
|
|
391
|
+
if (part.type === "text") {
|
|
392
|
+
if (part.text.length > 0) {
|
|
393
|
+
content.push({ type: "text", text: part.text });
|
|
394
|
+
}
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (part.type === "image" || part.mediaType.startsWith("image/")) {
|
|
398
|
+
content.push({ type: "image_url", image_url: { url: part.url } });
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
return content.length > 0 ? content : readTextParts(parts);
|
|
403
|
+
}
|
|
404
|
+
|
|
362
405
|
export function toOpenAICompatibleMessages(
|
|
363
406
|
prompt: RuntimePromptMessage[],
|
|
364
407
|
): OpenAICompatibleChatMessage[] {
|
|
@@ -370,7 +413,7 @@ export function toOpenAICompatibleMessages(
|
|
|
370
413
|
messages.push({ role: "system", content: message.content });
|
|
371
414
|
break;
|
|
372
415
|
case "user":
|
|
373
|
-
messages.push({ role: "user", content:
|
|
416
|
+
messages.push({ role: "user", content: toOpenAICompatibleUserContent(message.content) });
|
|
374
417
|
break;
|
|
375
418
|
case "assistant": {
|
|
376
419
|
let text = "";
|
|
@@ -73,7 +73,13 @@ type EmbedManyOptions = {
|
|
|
73
73
|
|
|
74
74
|
type RuntimePromptMessage =
|
|
75
75
|
| { role: "system"; content: string }
|
|
76
|
-
| {
|
|
76
|
+
| {
|
|
77
|
+
role: "user";
|
|
78
|
+
content: Array<
|
|
79
|
+
| { type: "text"; text: string }
|
|
80
|
+
| { type: "image" | "file"; mediaType: string; url: string; filename?: string }
|
|
81
|
+
>;
|
|
82
|
+
}
|
|
77
83
|
| {
|
|
78
84
|
role: "assistant";
|
|
79
85
|
content: Array<
|
|
@@ -181,7 +187,9 @@ function toRuntimePrompt(
|
|
|
181
187
|
case "user":
|
|
182
188
|
prompt.push({
|
|
183
189
|
role: "user",
|
|
184
|
-
content:
|
|
190
|
+
content: typeof message.content === "string"
|
|
191
|
+
? [{ type: "text", text: message.content }]
|
|
192
|
+
: message.content,
|
|
185
193
|
});
|
|
186
194
|
break;
|
|
187
195
|
case "assistant":
|