mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-08 22:48:14 -05:00
feat(byok): byok for hosted model capabilities (#2574)
* feat(byok): byok for hosted model capabilities * fix type * add ignore lint * accidentally added feature flags * centralize byok fetch for LLM calls * remove feature flags ts * fix tests * update docs
This commit is contained in:
committed by
GitHub
parent
40a6bf5c8c
commit
47a259b428
14
packages/db/migrations/0133_smiling_cargill.sql
Normal file
14
packages/db/migrations/0133_smiling_cargill.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
CREATE TABLE "workspace_byok_keys" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"workspace_id" text NOT NULL,
|
||||
"provider_id" text NOT NULL,
|
||||
"encrypted_api_key" text NOT NULL,
|
||||
"created_by" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "workspace_byok_keys" ADD CONSTRAINT "workspace_byok_keys_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "workspace_byok_keys" ADD CONSTRAINT "workspace_byok_keys_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "workspace_byok_provider_unique" ON "workspace_byok_keys" USING btree ("workspace_id","provider_id");--> statement-breakpoint
|
||||
CREATE INDEX "workspace_byok_workspace_idx" ON "workspace_byok_keys" USING btree ("workspace_id");
|
||||
8571
packages/db/migrations/meta/0133_snapshot.json
Normal file
8571
packages/db/migrations/meta/0133_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -925,6 +925,13 @@
|
||||
"when": 1766529613309,
|
||||
"tag": "0132_dazzling_leech",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 133,
|
||||
"version": "7",
|
||||
"when": 1766607372265,
|
||||
"tag": "0133_smiling_cargill",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -420,6 +420,28 @@ export const workspaceEnvironment = pgTable(
|
||||
})
|
||||
)
|
||||
|
||||
export const workspaceBYOKKeys = pgTable(
|
||||
'workspace_byok_keys',
|
||||
{
|
||||
id: text('id').primaryKey(),
|
||||
workspaceId: text('workspace_id')
|
||||
.notNull()
|
||||
.references(() => workspace.id, { onDelete: 'cascade' }),
|
||||
providerId: text('provider_id').notNull(),
|
||||
encryptedApiKey: text('encrypted_api_key').notNull(),
|
||||
createdBy: text('created_by').references(() => user.id, { onDelete: 'set null' }),
|
||||
createdAt: timestamp('created_at').notNull().defaultNow(),
|
||||
updatedAt: timestamp('updated_at').notNull().defaultNow(),
|
||||
},
|
||||
(table) => ({
|
||||
workspaceProviderUnique: uniqueIndex('workspace_byok_provider_unique').on(
|
||||
table.workspaceId,
|
||||
table.providerId
|
||||
),
|
||||
workspaceIdx: index('workspace_byok_workspace_idx').on(table.workspaceId),
|
||||
})
|
||||
)
|
||||
|
||||
export const settings = pgTable('settings', {
|
||||
id: text('id').primaryKey(), // Use the user id as the key
|
||||
userId: text('user_id')
|
||||
|
||||
Reference in New Issue
Block a user