diff --git a/src/renderer/src/components/Popups/TemplatePopup.tsx b/src/renderer/src/components/Popups/TemplatePopup.tsx index 786d01a5..5c7189b0 100644 --- a/src/renderer/src/components/Popups/TemplatePopup.tsx +++ b/src/renderer/src/components/Popups/TemplatePopup.tsx @@ -1,9 +1,8 @@ +import { Box } from '@renderer/components/Layout' +import { TopView } from '@renderer/components/TopView' import { Modal } from 'antd' import { useState } from 'react' -import { Box } from '../Layout' -import { TopView } from '../TopView' - interface ShowParams { title: string } diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index f24a1fdc..c9720f68 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -982,6 +982,7 @@ "search": "Search Providers...", "search_placeholder": "Search model id or name", "title": "Model Provider", + "is_not_support_array_content": "Enable compatible mode", "copilot": { "tooltip": "You need to log in to Github before using Github Copilot", "description": "Your GitHub account needs to subscribe to Copilot.", diff --git a/src/renderer/src/i18n/locales/ja-jp.json b/src/renderer/src/i18n/locales/ja-jp.json index b4683f91..c3e3dc0b 100644 --- a/src/renderer/src/i18n/locales/ja-jp.json +++ b/src/renderer/src/i18n/locales/ja-jp.json @@ -982,6 +982,7 @@ "search": "プロバイダーを検索...", "search_placeholder": "モデルIDまたは名前を検索", "title": "モデルプロバイダー", + "is_not_support_array_content": "互換モードを有効にする", "copilot": { "tooltip": "Github Copilot を使用するには、まず Github にログインする必要があります。", "description": "あなたのGithubアカウントはCopilotを購読する必要があります。", diff --git a/src/renderer/src/i18n/locales/ru-ru.json b/src/renderer/src/i18n/locales/ru-ru.json index d073aa24..e8aa14b0 100644 --- a/src/renderer/src/i18n/locales/ru-ru.json +++ b/src/renderer/src/i18n/locales/ru-ru.json @@ -982,6 +982,7 @@ "search": "Поиск поставщиков...", "search_placeholder": "Поиск по ID или имени модели", "title": "Провайдеры моделей", + "is_not_support_array_content": "Включить совместимый режим", "copilot": { "tooltip": "Для использования Github Copilot необходимо сначала войти в Github.", "description": "Ваша учетная запись Github должна подписаться на Copilot.", diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index 541f4e90..8c5125c4 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -982,6 +982,7 @@ "search": "搜索模型平台...", "search_placeholder": "搜索模型 ID 或名称", "title": "模型服务", + "is_not_support_array_content": "开启兼容模式", "copilot": { "tooltip": "使用 Github Copilot 需要先登录 Github", "description": "您的 Github 账号需要订阅 Copilot", diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index 6c6c8e6d..d9d7ca7f 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -982,6 +982,7 @@ "search": "搜尋模型平臺...", "search_placeholder": "搜尋模型 ID 或名稱", "title": "模型提供者", + "is_not_support_array_content": "開啟相容模式", "copilot": { "tooltip": "使用 Github Copilot 需要先登入 Github", "description": "您的 Github 帳號需要訂閱 Copilot", diff --git a/src/renderer/src/pages/settings/ProviderSettings/ProviderSetting.tsx b/src/renderer/src/pages/settings/ProviderSettings/ProviderSetting.tsx index fd4880a1..6340782a 100644 --- a/src/renderer/src/pages/settings/ProviderSettings/ProviderSetting.tsx +++ b/src/renderer/src/pages/settings/ProviderSettings/ProviderSetting.tsx @@ -1,4 +1,4 @@ -import { CheckOutlined, ExportOutlined, HeartOutlined, LoadingOutlined } from '@ant-design/icons' +import { CheckOutlined, ExportOutlined, HeartOutlined, LoadingOutlined, SettingOutlined } from '@ant-design/icons' import { HStack } from '@renderer/components/Layout' import OAuthButton from '@renderer/components/OAuth/OAuthButton' import { PROVIDER_CONFIG } from '@renderer/config/providers' @@ -35,6 +35,7 @@ import HealthCheckPopup from './HealthCheckPopup' import LMStudioSettings from './LMStudioSettings' import ModelList, { ModelStatus } from './ModelList' import OllamSettings from './OllamaSettings' +import ProviderSettingsPopup from './ProviderSettingsPopup' import SelectProviderModelPopup from './SelectProviderModelPopup' interface Props { @@ -269,6 +270,11 @@ const ProviderSetting: FC = ({ provider: _provider }) => { )} + {!provider.isSystem && ( + + )} void +} + +const PopupContainer: React.FC = ({ resolve, ...props }) => { + const [open, setOpen] = useState(true) + const [isNotSupportArrayContent, setIsNotSupportArrayContent] = useState(props.provider.isNotSupportArrayContent) + + const { provider, updateProvider } = useProvider(props.provider.id) + + const { t } = useTranslation() + + const onOk = () => { + setOpen(false) + } + + const onCancel = () => { + setOpen(false) + } + + const onClose = () => { + resolve({}) + } + + ProviderSettingsPopup.hide = onCancel + + return ( + + { + setIsNotSupportArrayContent(e.target.checked) + updateProvider({ ...provider, isNotSupportArrayContent: e.target.checked }) + }}> + {t('settings.provider.is_not_support_array_content')} + + + ) +} + +const TopViewKey = 'ProviderSettingsPopup' + +export default class ProviderSettingsPopup { + static topviewId = 0 + static hide() { + TopView.hide(TopViewKey) + } + static show(props: ShowParams) { + return new Promise((resolve) => { + TopView.show( + { + resolve(v) + TopView.hide(TopViewKey) + }} + />, + TopViewKey + ) + }) + } +} diff --git a/src/renderer/src/providers/OpenAIProvider.ts b/src/renderer/src/providers/OpenAIProvider.ts index 5516cd02..76fecc30 100644 --- a/src/renderer/src/providers/OpenAIProvider.ts +++ b/src/renderer/src/providers/OpenAIProvider.ts @@ -82,7 +82,12 @@ export default class OpenAIProvider extends BaseProvider { * @returns True if the provider does not support files, false otherwise */ private get isNotSupportFiles() { + if (this.provider?.isNotSupportArrayContent) { + return true + } + const providers = ['deepseek', 'baichuan', 'minimax', 'xirang'] + return providers.includes(this.provider.id) } diff --git a/src/renderer/src/types/index.ts b/src/renderer/src/types/index.ts index 91e8c548..f520895f 100644 --- a/src/renderer/src/types/index.ts +++ b/src/renderer/src/types/index.ts @@ -118,6 +118,7 @@ export type Provider = { isSystem?: boolean isAuthed?: boolean rateLimit?: number + isNotSupportArrayContent?: boolean } export type ProviderType = 'openai' | 'anthropic' | 'gemini' | 'qwenlm' | 'azure-openai'