Implement comprehensive LLM provider system with global cost protection
- Add multi-provider LLM architecture supporting OpenRouter, OpenAI, Gemini, and custom providers - Implement global LLM on/off switch with default DISABLED state for cost protection - Add per-character LLM configuration with provider-specific models and settings - Create performance-optimized caching system for LLM enabled status checks - Add API key validation before enabling LLM providers to prevent broken configurations - Implement audit logging for all LLM enable/disable actions for cost accountability - Create comprehensive admin UI with prominent cost warnings and confirmation dialogs - Add visual indicators in character list for custom AI model configurations - Build character-specific LLM client system with global fallback mechanism - Add database schema support for per-character LLM settings - Implement graceful fallback responses when LLM is globally disabled - Create provider testing and validation system for reliable connections
This commit is contained in:
18
migrations/006_add_character_llm_settings.sql
Normal file
18
migrations/006_add_character_llm_settings.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Add LLM configuration columns to characters table
|
||||
-- Migration: 006_add_character_llm_settings.sql
|
||||
|
||||
ALTER TABLE characters
|
||||
ADD COLUMN llm_provider VARCHAR(50),
|
||||
ADD COLUMN llm_model VARCHAR(100),
|
||||
ADD COLUMN llm_temperature FLOAT,
|
||||
ADD COLUMN llm_max_tokens INTEGER;
|
||||
|
||||
-- Add indexes for common queries
|
||||
CREATE INDEX IF NOT EXISTS ix_characters_llm_provider ON characters(llm_provider);
|
||||
CREATE INDEX IF NOT EXISTS ix_characters_llm_model ON characters(llm_model);
|
||||
|
||||
-- Add comments for documentation
|
||||
COMMENT ON COLUMN characters.llm_provider IS 'Per-character LLM provider override (openrouter, openai, gemini, custom)';
|
||||
COMMENT ON COLUMN characters.llm_model IS 'Specific model name for this character';
|
||||
COMMENT ON COLUMN characters.llm_temperature IS 'Creativity/randomness setting (0.1-2.0)';
|
||||
COMMENT ON COLUMN characters.llm_max_tokens IS 'Maximum response length for this character';
|
||||
Reference in New Issue
Block a user