mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-26 13:19:34 +07:00
👷 build: add settings column to agent_bot_providers (#13081)
This commit is contained in:
@@ -79,6 +79,7 @@ table agent_bot_providers {
|
||||
platform varchar(50) [not null]
|
||||
application_id varchar(255) [not null]
|
||||
credentials text
|
||||
settings jsonb [default: `{}`]
|
||||
enabled boolean [not null, default: true]
|
||||
accessed_at "timestamp with time zone" [not null, default: `now()`]
|
||||
created_at "timestamp with time zone" [not null, default: `now()`]
|
||||
@@ -123,6 +124,46 @@ table agent_cron_jobs {
|
||||
}
|
||||
}
|
||||
|
||||
table agent_documents {
|
||||
id uuid [pk, not null, default: `gen_random_uuid()`]
|
||||
user_id text [not null]
|
||||
agent_id text [not null]
|
||||
document_id varchar(255) [not null]
|
||||
template_id varchar(100)
|
||||
access_self integer [not null, default: 31]
|
||||
access_shared integer [not null, default: 0]
|
||||
access_public integer [not null, default: 0]
|
||||
policy_load varchar(30) [not null, default: 'always']
|
||||
policy jsonb
|
||||
policy_load_position varchar(50) [not null, default: 'before-first-user']
|
||||
policy_load_format varchar(20) [not null, default: 'raw']
|
||||
policy_load_rule varchar(50) [not null, default: 'always']
|
||||
deleted_at "timestamp with time zone"
|
||||
deleted_by_user_id text
|
||||
deleted_by_agent_id text
|
||||
delete_reason text
|
||||
created_at "timestamp with time zone" [not null, default: `now()`]
|
||||
updated_at "timestamp with time zone" [not null, default: `now()`]
|
||||
|
||||
indexes {
|
||||
user_id [name: 'agent_documents_user_id_idx']
|
||||
agent_id [name: 'agent_documents_agent_id_idx']
|
||||
access_self [name: 'agent_documents_access_self_idx']
|
||||
access_shared [name: 'agent_documents_access_shared_idx']
|
||||
access_public [name: 'agent_documents_access_public_idx']
|
||||
policy_load [name: 'agent_documents_policy_load_idx']
|
||||
template_id [name: 'agent_documents_template_id_idx']
|
||||
policy_load_position [name: 'agent_documents_policy_load_position_idx']
|
||||
policy_load_format [name: 'agent_documents_policy_load_format_idx']
|
||||
policy_load_rule [name: 'agent_documents_policy_load_rule_idx']
|
||||
(agent_id, policy_load_position) [name: 'agent_documents_agent_load_position_idx']
|
||||
deleted_at [name: 'agent_documents_deleted_at_idx']
|
||||
(agent_id, deleted_at, policy_load) [name: 'agent_documents_agent_autoload_deleted_idx']
|
||||
document_id [name: 'agent_documents_document_id_idx']
|
||||
(agent_id, document_id, user_id) [name: 'agent_documents_agent_document_user_unique', unique]
|
||||
}
|
||||
}
|
||||
|
||||
table agent_eval_benchmarks {
|
||||
id text [pk, not null]
|
||||
identifier text [not null]
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE "agent_bot_providers" ADD COLUMN IF NOT EXISTS "settings" jsonb DEFAULT '{}'::jsonb;
|
||||
12878
packages/database/migrations/meta/0094_snapshot.json
Normal file
12878
packages/database/migrations/meta/0094_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -658,6 +658,13 @@
|
||||
"when": 1773653550268,
|
||||
"tag": "0093_add_bm25_indexes_with_icu",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 94,
|
||||
"version": "7",
|
||||
"when": 1773764776073,
|
||||
"tag": "0094_agent_bot_providers_add_settings",
|
||||
"breakpoints": true
|
||||
}
|
||||
],
|
||||
"version": "6"
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
import { boolean, index, pgTable, text, uniqueIndex, uuid, varchar } from 'drizzle-orm/pg-core';
|
||||
import {
|
||||
boolean,
|
||||
index,
|
||||
jsonb,
|
||||
pgTable,
|
||||
text,
|
||||
uniqueIndex,
|
||||
uuid,
|
||||
varchar,
|
||||
} from 'drizzle-orm/pg-core';
|
||||
import { createInsertSchema } from 'drizzle-zod';
|
||||
|
||||
import { timestamps } from './_helpers';
|
||||
@@ -33,12 +42,15 @@ export const agentBotProviders = pgTable(
|
||||
/** Encrypted credentials string (decrypted to JSON with botToken, publicKey, etc.) */
|
||||
credentials: text('credentials'),
|
||||
|
||||
/** User-configurable settings (dm policy, charLimit, debounce, etc.) */
|
||||
settings: jsonb('settings').$type<Record<string, unknown>>().default({}),
|
||||
|
||||
enabled: boolean('enabled').default(true).notNull(),
|
||||
|
||||
...timestamps,
|
||||
},
|
||||
(t) => [
|
||||
// Fast webhook lookup: platform + applicationId → agent
|
||||
// Fast lookup: platform + applicationId → agent
|
||||
uniqueIndex('agent_bot_providers_platform_app_id_unique').on(t.platform, t.applicationId),
|
||||
index('agent_bot_providers_platform_idx').on(t.platform),
|
||||
index('agent_bot_providers_agent_id_idx').on(t.agentId),
|
||||
|
||||
Reference in New Issue
Block a user