Skip to content

Commit 4b7db15

Browse files
committed
Move defaultConfig from customProviders to root
1 parent f2e4ed7 commit 4b7db15

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Drop uneeded `ollama useTools` and `ollama think` configs.
77
- Refactor configs for config providers unification.
88
- `<provider>ApiKey` and `<providerApiUrl>` now live in `:providers "<provider>" :key`.
9+
- Move `defaultModel` config from customProvider to root.
910

1011
## 0.30.0
1112

docs/configuration.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ There are 3 possible ways to configure rules following this order of priority:
157157
url?: string;
158158
key?: string; // when provider supports api key.
159159
}};
160+
defaultModel?: string;
160161
rules: [{path: string;}];
161162
commands: [{path: string;}];
162163
systemPromptTemplateFile?: string;
@@ -179,7 +180,6 @@ There are 3 possible ways to configure rules following this order of priority:
179180
customProviders: {[key: string]: {
180181
api: 'openai-responses' | 'openai-chat' | 'anthropic';
181182
models: string[];
182-
defaultModel?: string;
183183
url?: string;
184184
urlEnv?: string;
185185
completionUrlRelativePath?: string;
@@ -217,6 +217,7 @@ There are 3 possible ways to configure rules following this order of priority:
217217
"github-copilot": {"url": "https://api.githubcopilot.com"},
218218
"ollama": {"url": "http://localhost:11434"}
219219
},
220+
"defaultModel": nil, // let ECA decides the default model.
220221
"rules" : [],
221222
"commands" : [],
222223
"nativeTools": {"filesystem": {"enabled": true},

integration-test/integration/chat/custom_provider_test.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
(eca/request! (fixture/initialize-request
2222
{:initializationOptions
2323
(merge fixture/default-init-options
24-
{:customProviders
24+
{:defaultModel "foo-1"
25+
:customProviders
2526
{"myProvider"
2627
{:api "openai-responses"
2728
:url (str "http://localhost:" llm-mock.server/port "/openai")
2829
:key "foobar"
29-
:models ["foo-0" "foo-1"]
30-
:defaultModel "foo-1"}}})
30+
:models ["foo-0" "foo-1"]}}})
3131
:capabilities {:codeAssistant {:chat {}}}})))))
3232
(eca/notify! (fixture/initialized-notification))
3333
(let [chat-id* (atom nil)]
@@ -144,13 +144,13 @@
144144
(eca/request! (fixture/initialize-request
145145
{:initializationOptions
146146
(merge fixture/default-init-options
147-
{:customProviders
147+
{:defaultModel "deepseek-coder"
148+
:customProviders
148149
{"myProvider"
149150
{:api "openai-chat"
150151
:url (str "http://localhost:" llm-mock.server/port "/openai-chat")
151152
:key "foobar"
152-
:models ["deepseek-chat" "deepseek-coder"]
153-
:defaultModel "deepseek-coder"}}})
153+
:models ["deepseek-chat" "deepseek-coder"]}}})
154154
:capabilities {:codeAssistant {:chat {}}}})))))
155155
(eca/notify! (fixture/initialized-notification))
156156
(let [chat-id* (atom nil)]

integration-test/integration/initialize_test.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@
8282
:chatWelcomeMessage "Welcome to ECA!\n\nType '/' for commands\n\n"}
8383
(eca/request! (fixture/initialize-request
8484
{:initializationOptions (merge fixture/default-init-options
85-
{:customProviders
85+
{:defaultModel "bar-2"
86+
:customProviders
8687
{"myCustom" {:api "openai"
8788
:urlEnv "MY_CUSTOM_API_URL"
8889
:keyEnv "MY_CUSTOM_API_KEY"
89-
:models ["foo-1" "bar-2"]
90-
:defaultModel "bar-2"}}})}))))))
90+
:models ["foo-1" "bar-2"]}}})}))))))

src/eca/config.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
:url "https://api.anthropic.com"}
2626
"github-copilot" {:url "https://api.githubcopilot.com"}
2727
"ollama" {:url "http://localhost:11434"}}
28+
:defaultModel nil
2829
:rules []
2930
:commands []
3031
:nativeTools {:filesystem {:enabled true}

src/eca/handlers.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
(swap! db* update :models merge eca-models)
2222
(when-let [custom-providers (seq (:customProviders config))]
2323
(let [models (reduce
24-
(fn [models [custom-provider {provider-models :models default-model :defaultModel}]]
24+
(fn [models [custom-provider {provider-models :models}]]
2525
(reduce
2626
(fn [m model]
2727
(let [known-model (get all-models model)]
@@ -32,7 +32,7 @@
3232
:web-search (or (:web-search known-model) true)
3333
:max-output-tokens (:max-output-tokens known-model)
3434
:custom-provider? true
35-
:default-model? (= model default-model)})))
35+
:default-model? (= model (:defaultModel config))})))
3636
models
3737
provider-models))
3838
{}

0 commit comments

Comments
 (0)