Skip to content

Commit 5dcb967

Browse files
authored
Merge pull request #277 from samhvw8/feat/roo-custom-model-info-openai-compatible
feat: custom model info in openai compatible
2 parents af1699a + 95fa1e4 commit 5dcb967

File tree

5 files changed

+448
-6
lines changed

5 files changed

+448
-6
lines changed

src/api/providers/openai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class OpenAiHandler implements ApiHandler, SingleCompletionHandler {
108108
getModel(): { id: string; info: ModelInfo } {
109109
return {
110110
id: this.options.openAiModelId ?? "",
111-
info: openAiModelInfoSaneDefaults,
111+
info: this.options.openAiCustomModelInfo ?? openAiModelInfoSaneDefaults,
112112
}
113113
}
114114

src/core/webview/ClineProvider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ type GlobalStateKey =
6969
| "taskHistory"
7070
| "openAiBaseUrl"
7171
| "openAiModelId"
72+
| "openAiCustomModelInfo"
7273
| "ollamaModelId"
7374
| "ollamaBaseUrl"
7475
| "lmStudioModelId"
@@ -1208,6 +1209,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
12081209
openAiBaseUrl,
12091210
openAiApiKey,
12101211
openAiModelId,
1212+
openAiCustomModelInfo,
12111213
ollamaModelId,
12121214
ollamaBaseUrl,
12131215
lmStudioModelId,
@@ -1241,6 +1243,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
12411243
await this.updateGlobalState("openAiBaseUrl", openAiBaseUrl)
12421244
await this.storeSecret("openAiApiKey", openAiApiKey)
12431245
await this.updateGlobalState("openAiModelId", openAiModelId)
1246+
await this.updateGlobalState("openAiCustomModelInfo", openAiCustomModelInfo)
12441247
await this.updateGlobalState("ollamaModelId", ollamaModelId)
12451248
await this.updateGlobalState("ollamaBaseUrl", ollamaBaseUrl)
12461249
await this.updateGlobalState("lmStudioModelId", lmStudioModelId)
@@ -1857,6 +1860,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
18571860
openAiBaseUrl,
18581861
openAiApiKey,
18591862
openAiModelId,
1863+
openAiCustomModelInfo,
18601864
ollamaModelId,
18611865
ollamaBaseUrl,
18621866
lmStudioModelId,
@@ -1920,6 +1924,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
19201924
this.getGlobalState("openAiBaseUrl") as Promise<string | undefined>,
19211925
this.getSecret("openAiApiKey") as Promise<string | undefined>,
19221926
this.getGlobalState("openAiModelId") as Promise<string | undefined>,
1927+
this.getGlobalState("openAiCustomModelInfo") as Promise<ModelInfo | undefined>,
19231928
this.getGlobalState("ollamaModelId") as Promise<string | undefined>,
19241929
this.getGlobalState("ollamaBaseUrl") as Promise<string | undefined>,
19251930
this.getGlobalState("lmStudioModelId") as Promise<string | undefined>,
@@ -2000,6 +2005,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
20002005
openAiBaseUrl,
20012006
openAiApiKey,
20022007
openAiModelId,
2008+
openAiCustomModelInfo,
20032009
ollamaModelId,
20042010
ollamaBaseUrl,
20052011
lmStudioModelId,

src/shared/WebviewMessage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export interface WebviewMessage {
7676
| "autoApprovalEnabled"
7777
| "updateCustomMode"
7878
| "deleteCustomMode"
79+
| "setopenAiCustomModelInfo"
7980
text?: string
8081
disabled?: boolean
8182
askResponse?: ClineAskResponse

src/shared/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface ApiHandlerOptions {
3838
openAiBaseUrl?: string
3939
openAiApiKey?: string
4040
openAiModelId?: string
41+
openAiCustomModelInfo?: ModelInfo
4142
ollamaModelId?: string
4243
ollamaBaseUrl?: string
4344
lmStudioModelId?: string

0 commit comments

Comments
 (0)