fix: could not add custom models (#5241)
* fix: could not add custom models * Update web-app/src/lib/completion.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * chore: remove hard coded ID string * fix: revert suggestion change --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
This commit is contained in:
parent
46add8e88a
commit
50b83d7342
@ -130,13 +130,36 @@ export const sendCompletion = async (
|
||||
// TODO: Retrieve from extension settings
|
||||
baseURL: provider.base_url,
|
||||
})
|
||||
if (
|
||||
thread.model.id &&
|
||||
!(thread.model.id in Object.values(models).flat()) &&
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
!tokenJS.extendedModelExist(providerName as any, thread.model?.id)
|
||||
) {
|
||||
try {
|
||||
tokenJS.extendModelList(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
providerName as any,
|
||||
thread.model?.id,
|
||||
// This is to inherit the model capabilities from another built-in model
|
||||
// Can be anything that support all model capabilities
|
||||
models.anthropic.models[0]
|
||||
)
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Failed to extend model list for ${providerName} with model ${thread.model.id}:`,
|
||||
error
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add message history
|
||||
const completion = stream
|
||||
? await tokenJS.chat.completions.create(
|
||||
{
|
||||
stream: true,
|
||||
provider: providerName,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
provider: providerName as any,
|
||||
model: thread.model?.id,
|
||||
messages,
|
||||
tools: normalizeTools(tools),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user