mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-20 07:00:09 +08:00
* fix: update AI SDK dependencies to latest versions * feat: Update provider configurations and API handling - Refactor provider configuration to support new API types and enhance API host formatting. - Introduce new utility functions for handling API versions and formatting Azure OpenAI hosts. - Update system models to include new capabilities and adjust provider types for CherryIN and VertexAI. - Enhance provider settings UI to accommodate new API types and improve user experience. - Implement migration logic for provider type updates and default API host settings. - Update translations for API host configuration tips across multiple languages. - Fix various type checks and utility functions to ensure compatibility with new provider types. * fix: update unsupported API version providers and add longcat to compatible provider IDs * fix: 移除不再使用的 Azure OpenAI API 版本参数,优化 API 主机格式化逻辑 feat: 在选择器组件中添加样式属性,增强可定制性 feat: 更新提供者设置,支持动态选择 API 主机字段 * refactor: 优化测试用例 * 修复: 更新工具调用处理器以支持新的工具调用类型 * feat: 添加TODO注释以改进基于AI SDK的供应商内置工具展示和类型安全处理 * feat: 添加对Google SDK的支持,更新流式参数构建逻辑以包含Google工具的上下文 * feat: 更新web搜索模型判断逻辑,使用SystemProviderIds常量替代硬编码字符串 * feat: 添加对@renderer/store的mock以支持测试环境 * feat: 添加API主机地址验证功能,更新相关逻辑以支持端点提取 * fix: i18n * fix(i18n): Auto update translations for PR #10808 * Apply suggestion from @EurFelux Co-authored-by: Phantom <eurfelux@gmail.com> * Apply suggestion from @EurFelux Co-authored-by: Phantom <eurfelux@gmail.com> * Apply suggestion from @EurFelux Co-authored-by: Phantom <eurfelux@gmail.com> * refactor: Simplify provider type migration logic and enhance API version validation * fix: Correct variable name from configedApiHost to configuredApiHost for consistency * fix: Update package.json to remove deprecated @ai-sdk/google version and streamline @ai-sdk/openai versioning * fix: 更新 hasAPIVersion 函数中的正则表达式以更准确地匹配 API 版本路径 * fix(api): 简化 validateApiHost 函数逻辑以始终返回 true fix(yarn): 更新 @ai-sdk/openai 版本至 2.0.53 并添加依赖项 * fix(api): 修正 validateApiHost 函数在使用哈希后缀时的验证逻辑 --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Phantom <eurfelux@gmail.com>
77 lines
3.0 KiB
Diff
Vendored
77 lines
3.0 KiB
Diff
Vendored
diff --git a/dist/index.js b/dist/index.js
|
|
index cc6652c4e7f32878a64a2614115bf7eeb3b7c890..76e989017549c89b45d633525efb1f318026d9b2 100644
|
|
--- a/dist/index.js
|
|
+++ b/dist/index.js
|
|
@@ -274,6 +274,7 @@ var openaiChatResponseSchema = (0, import_provider_utils3.lazyValidator)(
|
|
message: import_v42.z.object({
|
|
role: import_v42.z.literal("assistant").nullish(),
|
|
content: import_v42.z.string().nullish(),
|
|
+ reasoning_content: import_v42.z.string().nullish(),
|
|
tool_calls: import_v42.z.array(
|
|
import_v42.z.object({
|
|
id: import_v42.z.string().nullish(),
|
|
@@ -340,6 +341,7 @@ var openaiChatChunkSchema = (0, import_provider_utils3.lazyValidator)(
|
|
delta: import_v42.z.object({
|
|
role: import_v42.z.enum(["assistant"]).nullish(),
|
|
content: import_v42.z.string().nullish(),
|
|
+ reasoning_content: import_v42.z.string().nullish(),
|
|
tool_calls: import_v42.z.array(
|
|
import_v42.z.object({
|
|
index: import_v42.z.number(),
|
|
@@ -785,6 +787,14 @@ var OpenAIChatLanguageModel = class {
|
|
if (text != null && text.length > 0) {
|
|
content.push({ type: "text", text });
|
|
}
|
|
+ const reasoning =
|
|
+ choice.message.reasoning_content;
|
|
+ if (reasoning != null && reasoning.length > 0) {
|
|
+ content.push({
|
|
+ type: 'reasoning',
|
|
+ text: reasoning,
|
|
+ });
|
|
+ }
|
|
for (const toolCall of (_a = choice.message.tool_calls) != null ? _a : []) {
|
|
content.push({
|
|
type: "tool-call",
|
|
@@ -866,6 +876,7 @@ var OpenAIChatLanguageModel = class {
|
|
};
|
|
let isFirstChunk = true;
|
|
let isActiveText = false;
|
|
+ let isActiveReasoning = false;
|
|
const providerMetadata = { openai: {} };
|
|
return {
|
|
stream: response.pipeThrough(
|
|
@@ -920,6 +931,22 @@ var OpenAIChatLanguageModel = class {
|
|
return;
|
|
}
|
|
const delta = choice.delta;
|
|
+ const reasoningContent = delta.reasoning_content;
|
|
+ if (reasoningContent) {
|
|
+ if (!isActiveReasoning) {
|
|
+ controller.enqueue({
|
|
+ type: 'reasoning-start',
|
|
+ id: 'reasoning-0',
|
|
+ });
|
|
+ isActiveReasoning = true;
|
|
+ }
|
|
+
|
|
+ controller.enqueue({
|
|
+ type: 'reasoning-delta',
|
|
+ id: 'reasoning-0',
|
|
+ delta: reasoningContent,
|
|
+ });
|
|
+ }
|
|
if (delta.content != null) {
|
|
if (!isActiveText) {
|
|
controller.enqueue({ type: "text-start", id: "0" });
|
|
@@ -1032,6 +1059,9 @@ var OpenAIChatLanguageModel = class {
|
|
}
|
|
},
|
|
flush(controller) {
|
|
+ if (isActiveReasoning) {
|
|
+ controller.enqueue({ type: 'reasoning-end', id: 'reasoning-0' });
|
|
+ }
|
|
if (isActiveText) {
|
|
controller.enqueue({ type: "text-end", id: "0" });
|
|
}
|