Embeddings: make the provider list data-driven so adding a provider is one entry
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 30/100
- Issue 類型
- 重構
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- nextjs, typescript
研究方向
Start with EMBEDDING_PROVIDERS in lib/actions/ai-config.ts, then read ownEmbeddingModel and buildEmbeddingModel in lib/ai/models.ts, plus lib/ai/config-validation.ts and lib/ai/embedding-pin.ts. The settings list in app/(dashboard)/settings/page.tsx must be derived from the same registry. Done when the registry holds only openai and openai-compatible, existing behavior and validation messages are unchanged, and pnpm test and pnpm build pass.
由索引模型根據 Issue 內容生成。
描述
Copied from DeadantCo/answerLoops#102 · originally opened by sethr07 on 2026-11-20
Copied from https://github.com/answerLoops/answerLoops/issues/458 — originally opened by
@NathanTarberton 2026-10-23
What
Embedding providers are defined in several places that each assume OpenAI. Adding Gemini (#379) or Mistral (#380) today means touching all of them, and two contributors working in parallel would conflict on the same lines. This issue turns the provider list into one registry so that adding a provider is a single entry.
Why
The shared edits are the same for every provider. Doing them once, up front, lets #379 and #380 shrink to "add one entry, handle that model's vector size, write tests and docs", and keeps them from colliding.
Where the provider is hard-coded today
EMBEDDING_PROVIDERSinlib/actions/ai-config.tsis the list the server accepts (openai,openai-compatible). The settings form keeps a separate list of the same name inapp/(dashboard)/settings/page.tsx, so the two can drift.ownEmbeddingModelandbuildEmbeddingModelinlib/ai/models.tsalways build an OpenAI client.ownEmbeddingModelserves saved workspace config and the background re-embedding job;buildEmbeddingModelserves "Test connection" with values the user just typed.hasOwnEmbeddingConfiginlib/ai/embedding-pin.ts(and the matching key lookup insideownEmbeddingModel) lets only an OpenAI chat key stand in for an embedding key.validateAIConfiginlib/ai/config-validation.tshas OpenAI-specific rules: a key is required after switching to OpenAI, OpenAI embeddings need their own key when the chat provider is not OpenAI, and a custom endpoint needs a base URL.- The embedding check in
lib/ai/test-connection.tsbuilds its model throughbuildEmbeddingModel. embeddingDimensionsSupportedandKB_EMBEDDING_DIMENSIONSinlib/ai/platform-models.tsdecide whether a model can fill the fixed 1536-dimension vector column.
Scope
One registry that defines each embedding provider: id, label, how to build the model from a key and optional base URL, default model, fixed output dimension (or how to request one), and the validation rules that apply to it. The server schema, the settings form, lib/ai/models.ts, lib/ai/embedding-pin.ts, validateAIConfig and test-connection all read from the registry instead of branching on provider names. The registry ships with the existing entries only: openai and openai-compatible.
Acceptance
- Existing OpenAI and openai-compatible behavior is unchanged: same validation messages, same key fallback from an OpenAI chat key, same re-embedding behavior.
- The server and the settings form can no longer disagree about which providers exist.
- Unit tests cover the registry and each consumer.
- Docs under
content/docs/are updated to describe how embedding providers are defined. pnpm testandpnpm buildpass.
Related: #379 (Gemini), #380 (Mistral).
Start here: new to the project? Read CONTRIBUTING.md first. It covers the ground rules, running answerLoops locally, and how to open a pull request.
- 主要語言
- TypeScript
- 星號
- 0
- 分支
- 0
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
DeadantCo/answerLoopsdev 的其他 Issue
-
Widget: match the chat bubble color to the rest of the widget可能已有人在做 @sethr07 今天認領。 未關閉enhancement frontend help wanted
難度 2/5 半天 新手友好度 75/100
DeadantCo/answerLoopsdev#68 · 3 則留言 ·
-
Widget: make the chat window fit on small phones可能已有人在做 @sethr07 今天認領。 未關閉enhancement frontend good first issue help wanted
難度 2/5 1-3 小時 新手友好度 70/100
DeadantCo/answerLoopsdev#67 · 9 則留言 ·
-
Add 'select all' option to Slack channel picker in Settings可能已有人在做 @sethr07 今天認領。 未關閉frontend good first issue
難度 2/5 1-3 小時 新手友好度 68/100
DeadantCo/answerLoopsdev#22 · 5 則留言 ·
-
enhancement frontend help wanted
難度 4/5 3-5 天 新手友好度 45/100
DeadantCo/answerLoopsdev#141 ·
-
backend enhancement frontend help wanted
難度 4/5 3-5 天 新手友好度 45/100
DeadantCo/answerLoopsdev#140 ·
查看 DeadantCo/answerLoopsdev 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
External sources always come back in English: `lc` isn't passed to `/api/v3/external_sources`可能已有人在做 @Anurag1428 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 65/100
openfoodfacts/openfoodfacts-explorer#2264 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 80/100
cloudflare/workers-sdk#17139 ·
維護者通常 1 天內回覆
-
area: editor P3 type: feature
難度 2/5 1-3 小時 新手友好度 74/100
halisonworks/mod-codeling#290 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
colinhacks/zod#6776 ·
維護者通常 1 天內回覆