feat: Support LMStudio models

Adds support for LMStudio models, allowing users to access and use them within the application. This involves:

- Adding new functions to `db/models.ts` to handle LMStudio model IDs and fetch their information from the OpenAI API.
- Modifying the `ollamaFormatAllCustomModels` function to include LMStudio models in the list of available models.
- Introducing a timeout mechanism in `libs/openai.ts` to prevent API requests from hanging.

This change enhances the model selection experience, providing users with a wider range of models to choose from.
This commit is contained in:
n4ze3m
2024-10-12 19:05:21 +05:30
parent f1e40d5908
commit ddb8993f17
3 changed files with 89 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ export const pageAssistModel = async ({
if (isCustom) {
const modelInfo = await getModelInfo(model)
const providerInfo = await getOpenAIConfigById(modelInfo.provider_id)
console.log(modelInfo, providerInfo)
return new ChatOpenAI({
modelName: modelInfo.model_id,
openAIApiKey: providerInfo.apiKey || "temp",