Files
dataroom/features/ai/lib/vector-stores/upload-file-to-vector-store.ts
zeekay 9dff9e667e rip: enterprise dirs + paywalls — full AGPL, no commercial-license code
Drop the dual-licensed `ee/` tree entirely. All features previously
locked behind the Hanzo Dataroom Commercial License are now part of the
AGPL-3.0 core and freely available — custom domains, branded viewing,
advanced analytics, watermarks, access controls, Q&A, AI vector stores,
workflows, SAML SSO, dataroom invitations, conversations, templates.

Layout changes:
* `ee/features/{ai,conversations,workflows,permissions,storage,templates,
  dataroom-invitations,access-notifications,security,conversions}/` →
  `features/<name>/` (AGPL).
* `ee/limits/` → `lib/billing/limits/` with every plan resolving to an
  unlimited profile (no users/links/documents/domains/datarooms cap,
  conversations and watermarks always on).
* `ee/stripe/` → `lib/billing/legacy/` (already a compat shim over
  `@hanzoai/commerce`; renewal-reminder webhook is now a no-op).
* `ee/features/billing/cancellation/` deleted. Pause/unpause/cancel/
  retention routes now compile against `lib/billing/cancellation.ts`
  stubs that return 410 Gone; `isTeamPaused`/`isTeamPausedById` in
  `lib/billing/paused.ts` always report active. `CancellationModal` is
  a no-op shim in `components/billing/`.
* `app/(ee)/api/*` route group folded into `app/api/*` (SAML auth,
  SCIM, AI chat, workflows, FAQ, link-upload).

Build: `npm run build` green.
2026-06-07 11:46:48 -07:00

44 lines
1.0 KiB
TypeScript

import { openai } from "@/features/ai/lib/models/openai";
interface VectorStoreFileOptions {
vectorStoreId: string;
fileId: string;
metadata: {
teamId: string;
documentId: string;
documentName: string;
versionId: string;
folderId?: string;
dataroomId?: string;
dataroomDocumentId?: string;
dataroomFolderId?: string;
};
}
/**
* Upload a file to a vector store
* @param options - Vector store file options including vector store ID, file ID, and metadata
* @returns The vector store file ID
*/
export async function addFileToVectorStore({
vectorStoreId,
fileId,
metadata,
}: VectorStoreFileOptions): Promise<string> {
try {
// Add file to vector store with metadata
const vectorStoreFile = await openai.vectorStores.files.create(
vectorStoreId,
{
file_id: fileId,
attributes: metadata,
},
);
return vectorStoreFile.id;
} catch (error) {
console.error("Error adding file to vector store:", error);
throw new Error("Failed to add file to vector store");
}
}