fix(InputbarTools): allow url context for gemini endpoint type model (#10926)

fix(InputbarTools): allow url context for gemini endpoint type

Add condition to check for gemini endpoint type when determining URL context support
This commit is contained in:
Phantom 2025-10-24 13:55:10 +08:00 committed by GitHub
parent 4dfb73c982
commit 0081a0740f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -383,7 +383,9 @@ const InputbarTools = ({
key: 'url_context',
label: t('chat.input.url_context'),
component: <UrlContextButton ref={urlContextButtonRef} assistantId={assistant.id} />,
condition: isGeminiModel(model) && isSupportUrlContextProvider(getProviderByModel(model))
condition:
isGeminiModel(model) &&
(isSupportUrlContextProvider(getProviderByModel(model)) || model.endpoint_type === 'gemini')
},
{
key: 'knowledge_base',

View File

@ -133,6 +133,8 @@ export function getAssistantProvider(assistant: Assistant): Provider {
return provider || getDefaultProvider()
}
// FIXME: This function fails in silence.
// TODO: Refactor it to make it return exactly valid value or null, and update all usage.
export function getProviderByModel(model?: Model): Provider {
const providers = getStoreProviders()
const provider = providers.find((p) => p.id === model?.provider)
@ -145,6 +147,7 @@ export function getProviderByModel(model?: Model): Provider {
return provider
}
// FIXME: This function may return undefined but as Provider
export function getProviderByModelId(modelId?: string) {
const providers = getStoreProviders()
const _modelId = modelId || getDefaultModel().id