vim-todo-ai-bridge 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.js +5 -1
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -18,6 +18,8 @@ function readOmpArgs() {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const OMP_BIN = process.env.OMP_BIN || 'omp';
|
|
21
|
+
const OMP_DEFAULT_MODEL_IDS = ['claude-haiku-5-5', 'claude-haiku-4-5'];
|
|
22
|
+
let completeSeq = 0;
|
|
21
23
|
const OMP_ARGS = readOmpArgs();
|
|
22
24
|
const OMP_PROVIDER_IDS = {
|
|
23
25
|
openai: 'openai',
|
|
@@ -206,7 +208,7 @@ class OmpRpcClient {
|
|
|
206
208
|
String(candidate.id) === requestedValue ||
|
|
207
209
|
modelSelector(modelProviderId(candidate), candidate) === requestedValue
|
|
208
210
|
)
|
|
209
|
-
: matches[0];
|
|
211
|
+
: OMP_DEFAULT_MODEL_IDS.map((id) => matches.find((c) => String(c.id) === id)).find(Boolean) || matches[0];
|
|
210
212
|
if (!model) {
|
|
211
213
|
throw new Error(
|
|
212
214
|
requestedValue
|
|
@@ -234,7 +236,9 @@ class OmpRpcClient {
|
|
|
234
236
|
}
|
|
235
237
|
|
|
236
238
|
async complete(provider, requestedModel, prompt) {
|
|
239
|
+
const seq = ++completeSeq;
|
|
237
240
|
const run = this.requestQueue.catch(() => undefined).then(async () => {
|
|
241
|
+
if (seq !== completeSeq) throw new Error('superseded by a newer completion request');
|
|
238
242
|
const model = await this.resolveModel(provider, requestedModel);
|
|
239
243
|
await this.request('new_session');
|
|
240
244
|
await this.request('set_model', {
|