fix: remove pgvector dependency from AI knowledge retrieval
This commit is contained in:
@@ -63,8 +63,8 @@ Tests should mock database/provider boundaries and assert observable contracts,
|
||||
|
||||
## Compatibility
|
||||
|
||||
No database migration is required for this hardening pass.
|
||||
No new dependency is required.
|
||||
Deployment hardening additionally changes the still-unapplied `0007` AI migration from pgvector to JSONB embeddings, so production PostgreSQL 18 Alpine can run the migration without a `vector` extension.
|
||||
Existing persisted `resultJson.citations` remain readable; new analyses will have stricter citation lists.
|
||||
|
||||
## Rollback
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
5. Add AI route tests for permission failures, invalid input, service failure propagation, success responses, and audit calls.
|
||||
6. Improve knowledge UI and analysis dialog failure copy.
|
||||
7. Clarify `ai:manage` permission description.
|
||||
8. Run targeted AI tests, then project verification.
|
||||
8. Align AI knowledge embedding storage to JSONB for production PostgreSQL without pgvector.
|
||||
9. Run targeted AI tests, then project verification.
|
||||
|
||||
## Validation Commands
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ Harden the existing elder AI analysis and knowledge retrieval MVP so the critica
|
||||
|
||||
## Background
|
||||
|
||||
The current MVP already implements LangChain-backed elder AI analysis, pgvector-backed knowledge retrieval, permission-scoped resident context, persisted analysis history, and knowledge management UI.
|
||||
The current MVP now implements LangChain-backed elder AI analysis, PostgreSQL JSONB-backed knowledge retrieval, permission-scoped resident context, persisted analysis history, and knowledge management UI.
|
||||
|
||||
Current evidence from repository inspection:
|
||||
|
||||
- AI service files live under `modules/ai/`.
|
||||
- API routes live under `app/api/ai/`.
|
||||
- AI tables and vector extension are in `modules/core/server/schema.ts` and `drizzle/0007_purple_puff_adder.sql`.
|
||||
- AI tables and JSONB embedding storage are in `modules/core/server/schema.ts` and `drizzle/0007_purple_puff_adder.sql`; the production target does not require PostgreSQL `vector` extension support.
|
||||
- Existing project verification passes: `pnpm lint`, `pnpm type-check`, and `pnpm test`.
|
||||
- No AI-specific test file currently covers schema validation, permission scoping, history redaction, knowledge organization isolation, disabled knowledge exclusion, or provider failure behavior.
|
||||
- `normalizeCitations` currently appends allowed citations that the model did not necessarily cite, weakening the evidence chain.
|
||||
|
||||
Reference in New Issue
Block a user