Merge pull request #277 from samhvw8/feat/roo-custom-model-info-openai-compatible

feat: custom model info in openai compatible
This commit is contained in:
Matt Rubens
2025-01-21 11:44:49 -05:00
committed by GitHub
5 changed files with 448 additions and 6 deletions

View File

@@ -108,7 +108,7 @@ export class OpenAiHandler implements ApiHandler, SingleCompletionHandler {
getModel(): { id: string; info: ModelInfo } {
return {
id: this.options.openAiModelId ?? "",
info: openAiModelInfoSaneDefaults,
info: this.options.openAiCustomModelInfo ?? openAiModelInfoSaneDefaults,
}
}

View File

@@ -69,6 +69,7 @@ type GlobalStateKey =
| "taskHistory"
| "openAiBaseUrl"
| "openAiModelId"
| "openAiCustomModelInfo"
| "ollamaModelId"
| "ollamaBaseUrl"
| "lmStudioModelId"
@@ -1208,6 +1209,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
openAiBaseUrl,
openAiApiKey,
openAiModelId,
openAiCustomModelInfo,
ollamaModelId,
ollamaBaseUrl,
lmStudioModelId,
@@ -1241,6 +1243,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
await this.updateGlobalState("openAiBaseUrl", openAiBaseUrl)
await this.storeSecret("openAiApiKey", openAiApiKey)
await this.updateGlobalState("openAiModelId", openAiModelId)
await this.updateGlobalState("openAiCustomModelInfo", openAiCustomModelInfo)
await this.updateGlobalState("ollamaModelId", ollamaModelId)
await this.updateGlobalState("ollamaBaseUrl", ollamaBaseUrl)
await this.updateGlobalState("lmStudioModelId", lmStudioModelId)
@@ -1857,6 +1860,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
openAiBaseUrl,
openAiApiKey,
openAiModelId,
openAiCustomModelInfo,
ollamaModelId,
ollamaBaseUrl,
lmStudioModelId,
@@ -1920,6 +1924,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
this.getGlobalState("openAiBaseUrl") as Promise<string | undefined>,
this.getSecret("openAiApiKey") as Promise<string | undefined>,
this.getGlobalState("openAiModelId") as Promise<string | undefined>,
this.getGlobalState("openAiCustomModelInfo") as Promise<ModelInfo | undefined>,
this.getGlobalState("ollamaModelId") as Promise<string | undefined>,
this.getGlobalState("ollamaBaseUrl") as Promise<string | undefined>,
this.getGlobalState("lmStudioModelId") as Promise<string | undefined>,
@@ -2000,6 +2005,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
openAiBaseUrl,
openAiApiKey,
openAiModelId,
openAiCustomModelInfo,
ollamaModelId,
ollamaBaseUrl,
lmStudioModelId,

View File

@@ -76,6 +76,7 @@ export interface WebviewMessage {
| "autoApprovalEnabled"
| "updateCustomMode"
| "deleteCustomMode"
| "setopenAiCustomModelInfo"
text?: string
disabled?: boolean
askResponse?: ClineAskResponse

View File

@@ -38,6 +38,7 @@ export interface ApiHandlerOptions {
openAiBaseUrl?: string
openAiApiKey?: string
openAiModelId?: string
openAiCustomModelInfo?: ModelInfo
ollamaModelId?: string
ollamaBaseUrl?: string
lmStudioModelId?: string