compassmock/drizzle/0013_curved_ricochet.sql
Nicholai e3b708317c
feat(agent): AI model config with admin controls (#48)
* feat(agent): add AI model config with admin controls

per-user model selection with admin cost ceiling and
toggle. models filter/sort by output token cost. adds
usage tracking, provider icons, and settings UI.

* docs: add openclaw discord integration notes

---------

Co-authored-by: Nicholai <nicholaivogelfilms@gmail.com>
2026-02-06 20:36:31 -07:00

27 lines
978 B
SQL
Executable File

CREATE TABLE `agent_config` (
`id` text PRIMARY KEY NOT NULL,
`model_id` text NOT NULL,
`model_name` text NOT NULL,
`provider` text NOT NULL,
`prompt_cost` text NOT NULL,
`completion_cost` text NOT NULL,
`context_length` integer NOT NULL,
`updated_by` text NOT NULL,
`updated_at` text NOT NULL,
FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `agent_usage` (
`id` text PRIMARY KEY NOT NULL,
`conversation_id` text NOT NULL,
`user_id` text NOT NULL,
`model_id` text NOT NULL,
`prompt_tokens` integer DEFAULT 0 NOT NULL,
`completion_tokens` integer DEFAULT 0 NOT NULL,
`total_tokens` integer DEFAULT 0 NOT NULL,
`estimated_cost` text NOT NULL,
`created_at` text NOT NULL,
FOREIGN KEY (`conversation_id`) REFERENCES `agent_conversations`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);