fix: model checking error
This commit is contained in:
parent
1da1b6622d
commit
b3a023e4ac
@ -18,7 +18,8 @@ interface Props {
|
|||||||
provider: Provider
|
provider: Provider
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProviderSetting: FC<Props> = ({ provider }) => {
|
const ProviderSetting: FC<Props> = ({ provider: _provider }) => {
|
||||||
|
const { provider } = useProvider(_provider.id)
|
||||||
const [apiKey, setApiKey] = useState(provider.apiKey)
|
const [apiKey, setApiKey] = useState(provider.apiKey)
|
||||||
const [apiHost, setApiHost] = useState(provider.apiHost)
|
const [apiHost, setApiHost] = useState(provider.apiHost)
|
||||||
const [apiValid, setApiValid] = useState(false)
|
const [apiValid, setApiValid] = useState(false)
|
||||||
|
|||||||
@ -127,17 +127,17 @@ export async function checkApi(provider: Provider) {
|
|||||||
const style = { marginTop: '3vh' }
|
const style = { marginTop: '3vh' }
|
||||||
|
|
||||||
if (!provider.apiKey) {
|
if (!provider.apiKey) {
|
||||||
window.message.error({ content: t('error.enter.api.key'), key, style })
|
window.message.error({ content: t('message.error.enter.api.key'), key, style })
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!provider.apiHost) {
|
if (!provider.apiHost) {
|
||||||
window.message.error({ content: t('error.enter.api.host'), key, style })
|
window.message.error({ content: t('message.error.enter.api.host'), key, style })
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!model) {
|
if (!model) {
|
||||||
window.message.error({ content: t('error.enter.model'), key, style })
|
window.message.error({ content: t('message.error.enter.model'), key, style })
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,8 @@ export async function checkApi(provider: Provider) {
|
|||||||
try {
|
try {
|
||||||
const response = await openaiProvider.chat.completions.create({
|
const response = await openaiProvider.chat.completions.create({
|
||||||
model: model.id,
|
model: model.id,
|
||||||
messages: [{ role: 'user', content: 'hello' }],
|
messages: [{ role: 'user', content: 'hi' }],
|
||||||
|
max_tokens: 100,
|
||||||
stream: false
|
stream: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user