Skip to content

Commit 8f965e7

Browse files
committed
add capabilities automatically for openai provider
1 parent 0d9b678 commit 8f965e7

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

pkg/aiusechat/usechat-mode.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ func applyProviderDefaults(config *wconfig.AIModeConfigType) {
6161
if config.APITokenSecretName == "" {
6262
config.APITokenSecretName = "OPENAI_KEY"
6363
}
64+
if len(config.Capabilities) == 0 {
65+
if isO1Model(config.Model) {
66+
config.Capabilities = []string{}
67+
} else {
68+
config.Capabilities = []string{uctypes.AICapabilityTools, uctypes.AICapabilityImages, uctypes.AICapabilityPdfs}
69+
}
70+
}
6471
}
6572
if config.Provider == uctypes.AIProvider_OpenRouter {
6673
if config.Endpoint == "" {
@@ -176,6 +183,19 @@ func isLegacyOpenAIModel(model string) bool {
176183
return false
177184
}
178185

186+
func isO1Model(model string) bool {
187+
if model == "" {
188+
return false
189+
}
190+
o1Prefixes := []string{"o1", "o1-mini"}
191+
for _, prefix := range o1Prefixes {
192+
if aiutil.CheckModelPrefix(model, prefix) {
193+
return true
194+
}
195+
}
196+
return false
197+
}
198+
179199
func isValidAzureResourceName(name string) bool {
180200
if name == "" || len(name) > 63 {
181201
return false

0 commit comments

Comments
 (0)