mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 03:10:08 +08:00
feat(settings): add OpenAI alert (#6164)
This commit is contained in:
parent
9879a02ca8
commit
5dddf3c9d3
32
src/renderer/src/components/Alert/OpenAIAlert.tsx
Normal file
32
src/renderer/src/components/Alert/OpenAIAlert.tsx
Normal file
@ -0,0 +1,32 @@
|
||||
import { Alert } from 'antd'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
const LOCALSTORAGE_KEY = 'openai_alert_closed'
|
||||
|
||||
const OpenAIAlert = () => {
|
||||
const { t } = useTranslation()
|
||||
const [visible, setVisible] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
const closed = localStorage.getItem(LOCALSTORAGE_KEY)
|
||||
setVisible(!closed)
|
||||
}, [])
|
||||
|
||||
if (!visible) return null
|
||||
|
||||
return (
|
||||
<Alert
|
||||
style={{ width: '100%', marginTop: 5 }}
|
||||
message={t('settings.provider.openai.alert')}
|
||||
closable
|
||||
afterClose={() => {
|
||||
localStorage.setItem(LOCALSTORAGE_KEY, '1')
|
||||
setVisible(false)
|
||||
}}
|
||||
type="warning"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default OpenAIAlert
|
||||
@ -1468,6 +1468,9 @@
|
||||
"description": "This service is provided by <website>{{provider}}</website>",
|
||||
"official_website": "Official Website"
|
||||
},
|
||||
"openai": {
|
||||
"alert": "OpenAI Provider no longer support the old calling methods. If using a third-party API, please create a new service provider."
|
||||
},
|
||||
"copilot": {
|
||||
"auth_failed": "Github Copilot authentication failed.",
|
||||
"auth_success": "GitHub Copilot authentication successful.",
|
||||
|
||||
@ -1505,6 +1505,9 @@
|
||||
"title": "モデルノート",
|
||||
"placeholder": "Markdown形式の内容を入力してください...",
|
||||
"markdown_editor_default_value": "プレビュー領域"
|
||||
},
|
||||
"openai": {
|
||||
"alert": "OpenAIプロバイダーは旧式の呼び出し方法をサポートしなくなりました。サードパーティのAPIを使用している場合は、新しいサービスプロバイダーを作成してください。"
|
||||
}
|
||||
},
|
||||
"proxy": {
|
||||
@ -1632,7 +1635,9 @@
|
||||
"title": "ページズーム",
|
||||
"reset": "リセット"
|
||||
},
|
||||
"input.show_translate_confirm": "翻訳確認ダイアログを表示"
|
||||
"input.show_translate_confirm": "翻訳確認ダイアログを表示",
|
||||
"about.debug.title": "デバッグ",
|
||||
"about.debug.open": "開く"
|
||||
},
|
||||
"translate": {
|
||||
"any.language": "任意の言語",
|
||||
|
||||
@ -1505,6 +1505,9 @@
|
||||
"title": "Заметки модели",
|
||||
"placeholder": "Введите содержимое в формате Markdown...",
|
||||
"markdown_editor_default_value": "Область предварительного просмотра"
|
||||
},
|
||||
"openai": {
|
||||
"alert": "Поставщик OpenAI больше не поддерживает старые методы вызова. Если вы используете сторонний API, создайте нового поставщика услуг."
|
||||
}
|
||||
},
|
||||
"proxy": {
|
||||
@ -1632,7 +1635,9 @@
|
||||
"title": "Масштаб страницы",
|
||||
"reset": "Сбросить"
|
||||
},
|
||||
"input.show_translate_confirm": "Показать диалоговое окно подтверждения перевода"
|
||||
"input.show_translate_confirm": "Показать диалоговое окно подтверждения перевода",
|
||||
"about.debug.title": "[to be translated]:Debug",
|
||||
"about.debug.open": "[to be translated]:Open"
|
||||
},
|
||||
"translate": {
|
||||
"any.language": "Любой язык",
|
||||
|
||||
@ -1468,6 +1468,9 @@
|
||||
"description": "本服务由<website>{{provider}}</website>提供",
|
||||
"official_website": "官方网站"
|
||||
},
|
||||
"openai": {
|
||||
"alert": "OpenAI 服务商不再支持旧的调用方式,如果使用第三方 API 请新建服务商"
|
||||
},
|
||||
"copilot": {
|
||||
"auth_failed": "Github Copilot 认证失败",
|
||||
"auth_success": "Github Copilot 认证成功",
|
||||
|
||||
@ -1508,6 +1508,9 @@
|
||||
"title": "模型備註",
|
||||
"placeholder": "輸入Markdown格式內容...",
|
||||
"markdown_editor_default_value": "預覽區域"
|
||||
},
|
||||
"openai": {
|
||||
"alert": "OpenAI Provider 不再支援舊的呼叫方法。如果使用第三方 API,請建立新的服務供應商。"
|
||||
}
|
||||
},
|
||||
"proxy": {
|
||||
@ -1548,7 +1551,8 @@
|
||||
"toggle_show_topics": "切換話題顯示",
|
||||
"zoom_in": "放大介面",
|
||||
"zoom_out": "縮小介面",
|
||||
"zoom_reset": "重設縮放"
|
||||
"zoom_reset": "重設縮放",
|
||||
"exit_fullscreen": "退出螢幕"
|
||||
},
|
||||
"theme.auto": "自動",
|
||||
"theme.dark": "深色",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { CheckOutlined, LoadingOutlined } from '@ant-design/icons'
|
||||
import OpenAIAlert from '@renderer/components/Alert/OpenAIAlert'
|
||||
import { StreamlineGoodHealthAndWellBeing } from '@renderer/components/Icons/SVGIcon'
|
||||
import { HStack } from '@renderer/components/Layout'
|
||||
import { isEmbeddingModel, isRerankModel } from '@renderer/config/models'
|
||||
@ -326,6 +327,7 @@ const ProviderSetting: FC<Props> = ({ provider: _provider }) => {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{provider.id === 'openai' && <OpenAIAlert />}
|
||||
<SettingSubtitle style={{ marginTop: 5 }}>{t('settings.provider.api_key')}</SettingSubtitle>
|
||||
<Space.Compact style={{ width: '100%', marginTop: 5 }}>
|
||||
<Input.Password
|
||||
|
||||
Loading…
Reference in New Issue
Block a user