Commit Graph
23 Commits
Author SHA1 Message Date
yiling 39d45a1dc7 feat(agent): implement secure database-backed agent tools and comments context 2026-05-30 17:09:18 +08:00
yiling b9e35512e5 fix(db): rename collation from 'numeric' to 'natural_sort'
'numeric' is a reserved keyword and built-in type in PostgreSQL, which
can cause syntax parsing issues and ORM compatibility problems when used
as a collation name. Renamed to 'natural_sort' to be unambiguous and
self-documenting.
2026-05-29 15:30:35 +08:00
yiling ddac22a12f fix(db): persist hnsw.iterative_scan via ALTER DATABASE instead of SET
SET only applies to the current migration session and is lost when the
connection closes. Use a DO block with current_database() to execute
ALTER DATABASE ... SET, which persists the GUC for all future connections.

The DO block with format('%I', current_database()) avoids hardcoding
the database name and works on PostgreSQL < 16 (which lacks ALTER DATABASE
CURRENT syntax).
2026-05-29 15:29:29 +08:00
yiling 048028007e feat(db): add HNSW index on asset_embeddings and natural sort collation on assets.name
- Add HNSW index on asset_embeddings.embedding using vector_cosine_ops (m=16,
  ef_construction=64) with hnsw.iterative_scan=relaxed_order for efficient
  filtered ANN queries
- Create ICU numeric collation and alter assets.name column to use it for
  natural sort (file2 < file10 instead of lexicographic ordering)
- Add B-tree index on assets.name with numeric collation for sort performance
- Add schema @@index annotations to match migration index names
- Add 7 tests verifying natural sort behaviour in both AssetService.listChildren
  and SearchService.search (Prisma ORM and raw-SQL paths)
2026-05-29 15:18:31 +08:00
yiling 67b50ab6f0 chore(db): squash all migrations into a single initial migration
- Delete 19 historical migration files and directories

- Generate a new squashed migration 000000000000_squashed_migrations using prisma migrate diff

- Verify that all tests pass cleanly using Testcontainers with the squashed migration
2026-05-29 12:22:58 +08:00
yiling 40cb1986f4 fix(search): add migration for query_embedding_for_search task type 2026-05-28 20:19:25 +08:00
yiling 2eb6ff6c0e feat(search): add semantic search with embeddings and search mode toggle 2026-05-28 20:14:11 +08:00
yiling 5173bb2a01 feat: remove all ai transcription related code and schema 2026-05-28 14:23:02 +08:00
yiling 89916a2950 refactor(metadata): rename field_id to field_key in AssetMetadataValue
Rename the database column from field_id to field_key and the Prisma
property from fieldId to fieldKey to better reflect that the column
stores human-readable metadata field keys, not internal database IDs.

This fixes a bug where AI autofill wrote internal DB IDs instead of
field keys, causing metadata values to not display in the UI.

- Add SQL migration to rename the column
- Update metadata, search, and asset services
- Fix agent-autofill workflow to map fields by key
- Update all related test suites
2026-05-28 12:38:07 +08:00
yiling 794e7b3367 feat(collection): implement saved search results as collections 2026-05-25 17:29:45 +08:00
yiling 4949b92be8 chore(prisma): add migration for cleanup job refactor and revert test-global-setup.ts 2026-05-25 10:04:32 +08:00
yiling 2e09ce6ab5 refactor(asset): optimize cleanup job and solidify GC with locking 2026-05-25 09:57:46 +08:00
yiling 5dc3bdb38e feat(asset): decouple logical assets from physical storage with StorageKey and implement O(1) copy 2026-05-25 00:52:45 +08:00
yiling 0053d3a22c fix(asset): remove dangerous cascades that orphan s3 files 2026-05-23 23:44:24 +08:00
yiling effec44870 feat(trash): implement two-stage trashcan and project cleanup 2026-05-23 23:26:43 +08:00
yiling 8bc275e446 feat(project): implement async project deletion and storage cleanup 2026-05-23 18:09:30 +08:00
yiling 206e1ae7b1 fix(comment): remove unique constraint on session_id to allow multiple agent replies 2026-05-22 11:05:40 +08:00
yiling 2c106bbb77 feat(agent): add teamId foreign key to agent table and refactor service queries 2026-05-21 20:41:37 +08:00
yiling 15e9076147 feat(db): migrate AgentSession and AssetComment to 1:1 relation 2026-05-21 16:24:40 +08:00
yiling 161ba3a466 feat(agent): replace isAi with sessionId & implement admin logs UI 2026-05-21 14:58:31 +08:00
yiling 712b9d4185 refactor(agent): centralize sandbox allowedDomains default in prisma schema 2026-05-20 14:07:34 +08:00
yiling 53594194cc feat(agent): integrate sandboxed bash tool and sandbox settings 2026-05-20 10:36:47 +08:00
yiling 9cad96210c initial commit 2026-05-19 16:05:09 +08:00