Skip to content

VectorsDB support for console#2923

Open
premtsd-code wants to merge 16 commits intofeat-documentsdbfrom
feat-vectordb
Open

VectorsDB support for console#2923
premtsd-code wants to merge 16 commits intofeat-documentsdbfrom
feat-vectordb

Conversation

@premtsd-code
Copy link
Contributor

Summary

  • Full VectorsDB SDK integration (collections, documents, indexes, CRUD operations)
  • VectorsDB-specific UI: embedding editor with auto-fold, dimension field, HNSW index types
  • Route all collection pages through database-type-aware SDK helpers
  • Fix naming consistency (vectordb → vectorsdb)
  • Update SDK to 5fe49af with VectorsDB support
  • Add VectorsDB assets (SVGs, empty states)

Test plan

  • Create a vectorsdb database and collection
  • CRUD documents with embeddings
  • Create/delete HNSW indexes
  • Verify activity, usage, settings pages work for vectorsdb collections
  • Verify documentsdb/tablesdb collections still work unchanged

ItzNotABug and others added 7 commits February 11, 2026 17:27
- Route delete/update/index operations through database-type-aware SDK
  (settings, indexes, activity, usage pages were hardcoding documentsDB)
- Add updateEntity, deleteIndex methods to sdk.ts helper
- Fix pagination and document loading to use correct SDK for vectorsdb
- Fix realtime events to listen for both documentsdb and vectorsdb
- Fix embeddings: pass number[] directly instead of JSON.stringify roundtrip
- Auto-fold embeddings array in editor on document load
- Add !isVectorsDb guard to useMockSuggestions derivation
- Use single sliceString for bracket matching instead of per-char rope traversal
@appwrite
Copy link

appwrite bot commented Mar 20, 2026

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

Function scopes give you fine-grained control over API permissions

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cb91849d-bf6c-4bec-bdf5-a41a38c53160

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-vectordb

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR integrates VectorsDB as a first-class database type in the Appwrite Console, alongside the existing TablesDB and DocumentsDB. It adds a new SDK version (5fe49af), wires all collection-level CRUD, index, activity, usage, and settings pages through a type-aware SDK dispatch layer, and introduces VectorsDB-specific UI (embedding generation modal, dimension field, HNSW index type, empty-state assets).

Key changes:

  • sdk.ts / terminology.ts: A clean, extensible dispatch layer that switches on DatabaseType for every SDK call.
  • create/+page.svelte & empty.svelte: VectorsDB added to the database type selector and empty-state UI.
  • collection-[collection]/+layout.svelte: Critical bughandleCreateIndex calls useDatabaseSdk(region, project) without the third databaseType argument, so type is undefined in the closure and every index-creation attempt from the side sheet will throw "Unknown database type".
  • +page.svelte: A debug console.log(file, localFile) statement is left in the onSelect JSON-import handler.
  • embeddingModal.svelte: Embedding generation hits the backend by manually constructing a URL string (/vectorsdb/embeddings/text) rather than via a typed SDK call, making it fragile to endpoint changes.
  • views/create.svelte: The vector dimension InputNumber has no max constraint.

Confidence Score: 2/5

  • Not safe to merge — creating indexes from the collection side sheet is broken for every database type due to a missing argument in the useDatabaseSdk call.
  • The overall integration architecture is solid and consistent, but there is a clear runtime bug in collection-[collection]/+layout.svelte: useDatabaseSdk is invoked without the required database type, which will cause index creation from the side sheet to throw "Unknown database type" for all database types (tablesdb, documentsdb, and vectorsdb). There is also a leftover debug console.log and a hardcoded internal API path that introduce fragility. These issues prevent a confident merge.
  • collection-[collection]/+layout.svelte (critical bug), collection-[collection]/+page.svelte (debug log), embeddingModal.svelte (hardcoded endpoint)

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/helpers/sdk.ts Central SDK dispatch layer – adds vectorsdb branches to all CRUD operations. Logic is consistent and well-structured; no issues found.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/+layout.svelte Critical bug: useDatabaseSdk called without database.type in handleCreateIndex, causing a runtime throw for all database types when creating an index via the side sheet.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/+page.svelte Contains a leftover console.log(file, localFile) debug statement on line 72; otherwise document listing and empty-state rendering look correct.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/(components)/editor/embeddingModal.svelte New VectorsDB embedding generation modal. Hardcodes internal endpoint path /vectorsdb/embeddings/text via manual string concatenation instead of an SDK method; functional but fragile.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/views/create.svelte Adds VectorsDB dimension input to the create-collection modal. No upper bound is enforced on the dimension field.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/indexes/+page.svelte Routes index operations through the type-aware SDK helper. Contains a misleading DocumentsDBIndexType cast that is harmless at runtime but incorrect for VectorsDB.

Comments Outside Diff (2)

  1. src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/+layout.svelte, line 212 (link)

    P0 Missing database type in useDatabaseSdk call

    useDatabaseSdk is called with only two string arguments (region and project), so the type variable inside the returned SDK object will be undefined. When handleCreateIndex fires (from the side sheet), every createIndex call will reach the default branch and throw "Unknown database type", breaking index creation for all database types.

    The third argument (data.database.type) is needed here, exactly as it is passed in indexes/+page.svelte and settings/+page.svelte:

    async function handleCreateIndex(index: Index) {
        const databaseSdk = useDatabaseSdk(page.params.region, page.params.project, data.database.type);
        ...
  2. src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/+page.svelte, line 69-73 (link)

    P1 Debug console.log left in production code

    This console.log is a leftover debug statement and should be removed before merging.

Last reviewed commit: "merge feat-documents..."

generating = true;
try {
const client = sdk.forProject(page.params.region, page.params.project).client;
const uri = new URL(client.config.endpoint + '/vectorsdb/embeddings/text');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Hardcoded internal endpoint path

The embedding endpoint URL is constructed by manually appending a path string to the SDK's configured endpoint. This couples the component to an undocumented internal path (/vectorsdb/embeddings/text) and bypasses any SDK-level versioning or base-path changes. If the endpoint changes or if SDK methods are added for this operation, this string will silently break.

If the new SDK exposes a typed method for embedding generation, consider using it instead. At minimum, extract the path to a named constant so it is easier to update.

Comment on lines +127 to +133
<InputNumber
id="dimension"
label="Vector dimension"
bind:value={dimension}
min={1}
required />
{/if}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 No upper bound on vector dimension input

The InputNumber for VectorsDB dimension only enforces min={1} with no max constraint. Users can submit arbitrarily large values (e.g., 999999), which will be forwarded to the backend. It is worth adding a reasonable max value (e.g., 65535 or the actual backend limit) to prevent obvious mistakes and provide a better UX.

Comment on lines 22 to 23
key: index.key,
type: index.type as DocumentsDBIndexType,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Misleading DocumentsDBIndexType cast for VectorsDB

index.type is cast to DocumentsDBIndexType even though this page now handles VectorsDB collections that use different index types (e.g., HNSW). The cast is harmless at runtime because databaseSdk.createIndex accepts type: string and routes to the correct SDK internally, but it is incorrect and may confuse future maintainers.

Since DatabaseSdkResult.createIndex already accepts type: string, the cast can simply be dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants