fix(gateway): local infra defaults + qdrant collection retry-on-failure

- AI_LLM_BASE_URL default -> http://127.0.0.1:4014/v1 (was imrnes :20128/api/v1)
- QDRANT_URL fallback -> http://127.0.0.1:6333 (was imrnes :6333)
- ensureQdrantCollection: reset memoised promise on failure so a mid-way
  recreate abort (DELETE done, PUT failed) does not leave the collection
  permanently missing until process restart
- tests: qdrantEnsure.test.ts (3 cases: retry-on-failure, recreate, idempotent)
This commit is contained in:
asepharyana committed 2026-09-02 12:57:54 +07:00
1 parent e5304fde29
commit 4c38d53972
3 files changed
+89 -8

No files matched your search

@@ -50,10 +50,7 @@ export interface QdrantVerdictPayload {
}
function baseUrl(): string {
return (config.QDRANT_URL ?? "http://100.121.180.82:6333").replace(
/\/+$/,
"",
);
return (config.QDRANT_URL ?? "http://127.0.0.1:6333").replace(/\/+$/, "");
}
function collectionName(): string {
@@ -166,6 +163,11 @@ export async function ensureQdrantCollection(
},
"Failed to ensure Qdrant collection",
);
// The memoised promise is permanently sticky: once it rejects (e.g. a
// recreate aborted mid-way — DELETE done, PUT failed), every later call
// returns the same rejected promise and the collection is never
// re-created until process restart. Reset so the next call retries.
ensureCollectionPromise = null;
return false;
}
})();