feat: Add OpenAI Provider Selection
Add a provider selection dropdown to the OpenAI settings, enabling users to choose from pre-configured options like "Azure" or "Custom." This streamlines setup and allows for more flexibility in configuring OpenAI API endpoints. The dropdown pre-populates base URLs and names based on the selected provider. The dropdown also automatically populates base URLs and names based on the selected provider, further simplifying the configuration process.
This commit is contained in:
@@ -15,8 +15,8 @@ export const generateID = () => {
|
||||
})
|
||||
}
|
||||
|
||||
export const removeModelPrefix = (id: string) => {
|
||||
return id.replace(/^model-/, "")
|
||||
export const removeModelSuffix = (id: string) => {
|
||||
return id.replace(/_model-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{3,4}-[a-f0-9]{4}/, "")
|
||||
}
|
||||
|
||||
export const isCustomModel = (model: string) => {
|
||||
@@ -114,7 +114,8 @@ export const createManyModels = async (
|
||||
...item,
|
||||
lookup: `${item.model_id}_${item.provider_id}`,
|
||||
id: `${item.model_id}_${generateID()}`,
|
||||
db_type: "openai_model"
|
||||
db_type: "openai_model",
|
||||
name: item.name.replaceAll(/accounts\/[^\/]+\/models\//g, "")
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ type OpenAIModelConfig = {
|
||||
baseUrl: string
|
||||
apiKey?: string
|
||||
createdAt: number
|
||||
provider?: string
|
||||
db_type: string
|
||||
}
|
||||
export const generateID = () => {
|
||||
|
||||
Reference in New Issue
Block a user