mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-11 08:19:01 +08:00
* fix: update dependencies and patch files for strict JSON schema compliance - Updated `@ai-sdk/openai-compatible` to include version 1.0.30 and adjusted related patch files. - Removed obsolete patch for `@ai-sdk/openai-compatible@1.0.28`. - Added new patch for `@openrouter/ai-sdk-provider` to support strict JSON schema options. - Modified `options.ts` to set `strictJsonSchema` to false for OpenAI models. - Enhanced OpenAI compatible provider options to include `sendReasoning` and `strictJsonSchema`. - Updated lockfile to reflect changes in patched dependencies and their hashes. * fix: filter strictJsonSchema from request body in OpenRouter patch - Destructure and remove strictJsonSchema from openrouterOptions before spreading into request body - This prevents sending the internal option to the OpenRouter API Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
141 lines
7.0 KiB
Diff
141 lines
7.0 KiB
Diff
diff --git a/dist/index.js b/dist/index.js
|
|
index f33510a50d11a2cb92a90ea70cc0ac84c89f29b9..db0af7e2cc05c47baeb29c0a3974a155316fbd05 100644
|
|
--- a/dist/index.js
|
|
+++ b/dist/index.js
|
|
@@ -1050,7 +1050,8 @@ var OpenRouterProviderMetadataSchema = import_v43.z.object({
|
|
var OpenRouterProviderOptionsSchema = import_v43.z.object({
|
|
openrouter: import_v43.z.object({
|
|
reasoning_details: import_v43.z.array(ReasoningDetailUnionSchema).optional(),
|
|
- annotations: import_v43.z.array(FileAnnotationSchema).optional()
|
|
+ annotations: import_v43.z.array(FileAnnotationSchema).optional(),
|
|
+ strictJsonSchema: import_v43.z.boolean().optional()
|
|
}).optional()
|
|
}).optional();
|
|
|
|
@@ -1658,7 +1659,8 @@ var OpenRouterChatLanguageModel = class {
|
|
responseFormat,
|
|
topK,
|
|
tools,
|
|
- toolChoice
|
|
+ toolChoice,
|
|
+ providerOptions
|
|
}) {
|
|
var _a15;
|
|
const baseArgs = __spreadValues(__spreadValues({
|
|
@@ -1712,7 +1714,8 @@ var OpenRouterChatLanguageModel = class {
|
|
function: {
|
|
name: tool.name,
|
|
description: tool.description,
|
|
- parameters: tool.inputSchema
|
|
+ parameters: tool.inputSchema,
|
|
+ strict: providerOptions?.openrouter?.strictJsonSchema
|
|
}
|
|
}));
|
|
return __spreadProps(__spreadValues({}, baseArgs), {
|
|
@@ -1725,7 +1728,7 @@ var OpenRouterChatLanguageModel = class {
|
|
async doGenerate(options) {
|
|
var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
const providerOptions = options.providerOptions || {};
|
|
- const openrouterOptions = providerOptions.openrouter || {};
|
|
+ const { strictJsonSchema: _strictJsonSchema, ...openrouterOptions } = providerOptions.openrouter || {};
|
|
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
const { value: responseValue, responseHeaders } = await postJsonToApi({
|
|
url: this.config.url({
|
|
@@ -1931,7 +1934,7 @@ var OpenRouterChatLanguageModel = class {
|
|
async doStream(options) {
|
|
var _a15;
|
|
const providerOptions = options.providerOptions || {};
|
|
- const openrouterOptions = providerOptions.openrouter || {};
|
|
+ const { strictJsonSchema: _strictJsonSchema, ...openrouterOptions } = providerOptions.openrouter || {};
|
|
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
url: this.config.url({
|
|
@@ -2564,7 +2567,7 @@ var OpenRouterCompletionLanguageModel = class {
|
|
async doGenerate(options) {
|
|
var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
const providerOptions = options.providerOptions || {};
|
|
- const openrouterOptions = providerOptions.openrouter || {};
|
|
+ const { strictJsonSchema: _strictJsonSchema, ...openrouterOptions } = providerOptions.openrouter || {};
|
|
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
url: this.config.url({
|
|
@@ -2623,7 +2626,7 @@ var OpenRouterCompletionLanguageModel = class {
|
|
}
|
|
async doStream(options) {
|
|
const providerOptions = options.providerOptions || {};
|
|
- const openrouterOptions = providerOptions.openrouter || {};
|
|
+ const { strictJsonSchema: _strictJsonSchema, ...openrouterOptions } = providerOptions.openrouter || {};
|
|
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
url: this.config.url({
|
|
diff --git a/dist/index.mjs b/dist/index.mjs
|
|
index 8a688331b88b4af738ee4ca8062b5f24124d3d81..a2aa299a44352addc26f8891d839ea31a2150ee2 100644
|
|
--- a/dist/index.mjs
|
|
+++ b/dist/index.mjs
|
|
@@ -1015,7 +1015,8 @@ var OpenRouterProviderMetadataSchema = z3.object({
|
|
var OpenRouterProviderOptionsSchema = z3.object({
|
|
openrouter: z3.object({
|
|
reasoning_details: z3.array(ReasoningDetailUnionSchema).optional(),
|
|
- annotations: z3.array(FileAnnotationSchema).optional()
|
|
+ annotations: z3.array(FileAnnotationSchema).optional(),
|
|
+ strictJsonSchema: z3.boolean().optional()
|
|
}).optional()
|
|
}).optional();
|
|
|
|
@@ -1623,7 +1624,8 @@ var OpenRouterChatLanguageModel = class {
|
|
responseFormat,
|
|
topK,
|
|
tools,
|
|
- toolChoice
|
|
+ toolChoice,
|
|
+ providerOptions
|
|
}) {
|
|
var _a15;
|
|
const baseArgs = __spreadValues(__spreadValues({
|
|
@@ -1677,7 +1679,8 @@ var OpenRouterChatLanguageModel = class {
|
|
function: {
|
|
name: tool.name,
|
|
description: tool.description,
|
|
- parameters: tool.inputSchema
|
|
+ parameters: tool.inputSchema,
|
|
+ strict: providerOptions?.openrouter?.strictJsonSchema
|
|
}
|
|
}));
|
|
return __spreadProps(__spreadValues({}, baseArgs), {
|
|
@@ -1690,7 +1693,7 @@ var OpenRouterChatLanguageModel = class {
|
|
async doGenerate(options) {
|
|
var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
const providerOptions = options.providerOptions || {};
|
|
- const openrouterOptions = providerOptions.openrouter || {};
|
|
+ const { strictJsonSchema: _strictJsonSchema, ...openrouterOptions } = providerOptions.openrouter || {};
|
|
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
const { value: responseValue, responseHeaders } = await postJsonToApi({
|
|
url: this.config.url({
|
|
@@ -1896,7 +1899,7 @@ var OpenRouterChatLanguageModel = class {
|
|
async doStream(options) {
|
|
var _a15;
|
|
const providerOptions = options.providerOptions || {};
|
|
- const openrouterOptions = providerOptions.openrouter || {};
|
|
+ const { strictJsonSchema: _strictJsonSchema, ...openrouterOptions } = providerOptions.openrouter || {};
|
|
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
url: this.config.url({
|
|
@@ -2529,7 +2532,7 @@ var OpenRouterCompletionLanguageModel = class {
|
|
async doGenerate(options) {
|
|
var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
const providerOptions = options.providerOptions || {};
|
|
- const openrouterOptions = providerOptions.openrouter || {};
|
|
+ const { strictJsonSchema: _strictJsonSchema, ...openrouterOptions } = providerOptions.openrouter || {};
|
|
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
url: this.config.url({
|
|
@@ -2588,7 +2591,7 @@ var OpenRouterCompletionLanguageModel = class {
|
|
}
|
|
async doStream(options) {
|
|
const providerOptions = options.providerOptions || {};
|
|
- const openrouterOptions = providerOptions.openrouter || {};
|
|
+ const { strictJsonSchema: _strictJsonSchema, ...openrouterOptions } = providerOptions.openrouter || {};
|
|
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
url: this.config.url({
|