✨ Major Features: - Complete RAG system for hotel website analysis - Hybrid audit with BGE-M3 embeddings + Natasha NER - Universal horizontal Excel reports with dashboards - Multi-region processing (SPb, Orel, Chukotka, Kamchatka) 📊 Completed Regions: - Орловская область: 100% (36/36) - Чукотский АО: 100% (4/4) - г. Санкт-Петербург: 93% (893/960) - Камчатский край: 87% (89/102) 🔧 Infrastructure: - PostgreSQL with pgvector extension - BGE-M3 embeddings API - Browserless for web scraping - N8N workflows for automation - S3/Nextcloud file storage 📝 Documentation: - Complete DB schemas - API documentation - Setup guides - Status reports
74 lines
4.2 KiB
SQL
74 lines
4.2 KiB
SQL
-- Таблица для хранения настроек пользователей
|
||
CREATE TABLE IF NOT EXISTS user_settings (
|
||
id SERIAL PRIMARY KEY,
|
||
user_id VARCHAR(100) NOT NULL,
|
||
setting_key VARCHAR(100) NOT NULL,
|
||
setting_value TEXT NOT NULL,
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
UNIQUE(user_id, setting_key)
|
||
);
|
||
|
||
-- Индексы для быстрого поиска
|
||
CREATE INDEX IF NOT EXISTS idx_user_settings_user_id ON user_settings(user_id);
|
||
CREATE INDEX IF NOT EXISTS idx_user_settings_key ON user_settings(setting_key);
|
||
|
||
-- Таблица для хранения доступных моделей от провайдеров
|
||
CREATE TABLE IF NOT EXISTS llm_models (
|
||
id SERIAL PRIMARY KEY,
|
||
provider VARCHAR(50) NOT NULL,
|
||
model_id VARCHAR(100) NOT NULL,
|
||
model_name VARCHAR(200) NOT NULL,
|
||
description TEXT,
|
||
context_length INTEGER,
|
||
pricing_input DECIMAL(10,4),
|
||
pricing_output DECIMAL(10,4),
|
||
is_active BOOLEAN DEFAULT true,
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
UNIQUE(provider, model_id)
|
||
);
|
||
|
||
-- Индексы
|
||
CREATE INDEX IF NOT EXISTS idx_llm_models_provider ON llm_models(provider);
|
||
CREATE INDEX IF NOT EXISTS idx_llm_models_active ON llm_models(is_active);
|
||
|
||
-- Вставляем базовые модели OpenAI
|
||
INSERT INTO llm_models (provider, model_id, model_name, description, context_length, pricing_input, pricing_output) VALUES
|
||
('openai', 'gpt-4o-mini', 'GPT-4o Mini', 'Быстрая и дешёвая модель для чата', 128000, 0.15, 0.60),
|
||
('openai', 'gpt-4o', 'GPT-4o', 'Самая умная модель OpenAI', 128000, 5.00, 15.00),
|
||
('openai', 'gpt-4-turbo', 'GPT-4 Turbo', 'Мощная модель для сложных задач', 128000, 10.00, 30.00),
|
||
('openai', 'gpt-3.5-turbo', 'GPT-3.5 Turbo', 'Быстрая модель для простых задач', 16385, 0.50, 1.50),
|
||
('openai', 'gpt-4', 'GPT-4', 'Классическая GPT-4', 8192, 30.00, 60.00),
|
||
('openai', 'o1-preview', 'O1 Preview', 'Модель рассуждений', 128000, 15.00, 60.00),
|
||
('openai', 'o1-mini', 'O1 Mini', 'Компактная модель рассуждений', 128000, 3.00, 12.00),
|
||
|
||
-- Модели OpenRouter
|
||
('openrouter', 'anthropic/claude-3-haiku', 'Claude 3 Haiku', 'Быстрая модель Anthropic', 200000, 0.25, 1.25),
|
||
('openrouter', 'anthropic/claude-3-sonnet', 'Claude 3 Sonnet', 'Сбалансированная модель Anthropic', 200000, 3.00, 15.00),
|
||
('openrouter', 'anthropic/claude-3-opus', 'Claude 3 Opus', 'Самая мощная модель Anthropic', 200000, 15.00, 75.00),
|
||
('openrouter', 'google/gemini-pro', 'Gemini Pro', 'Модель Google', 30720, 0.50, 1.50),
|
||
('openrouter', 'google/gemini-pro-vision', 'Gemini Pro Vision', 'Модель Google с видением', 30720, 0.50, 1.50),
|
||
('openrouter', 'meta-llama/llama-3.1-8b-instruct', 'Llama 3.1 8B', 'Модель Meta Llama', 131072, 0.20, 0.20),
|
||
('openrouter', 'meta-llama/llama-3.1-70b-instruct', 'Llama 3.1 70B', 'Большая модель Meta Llama', 131072, 0.90, 0.90),
|
||
('openrouter', 'mistralai/mistral-7b-instruct', 'Mistral 7B', 'Модель Mistral', 32768, 0.20, 0.20),
|
||
('openrouter', 'mistralai/mixtral-8x7b-instruct', 'Mixtral 8x7B', 'Смешанная модель Mistral', 32768, 0.27, 0.27),
|
||
|
||
-- Модели Ollama (локальные)
|
||
('ollama', 'llama3.1', 'Llama 3.1', 'Локальная модель Llama', 131072, 0.00, 0.00),
|
||
('ollama', 'codellama', 'Code Llama', 'Модель для программирования', 131072, 0.00, 0.00),
|
||
('ollama', 'mistral', 'Mistral', 'Локальная модель Mistral', 32768, 0.00, 0.00),
|
||
('ollama', 'gemma', 'Gemma', 'Модель Google Gemma', 8192, 0.00, 0.00),
|
||
('ollama', 'phi3', 'Phi-3', 'Модель Microsoft Phi-3', 128000, 0.00, 0.00)
|
||
|
||
ON CONFLICT (provider, model_id) DO UPDATE SET
|
||
model_name = EXCLUDED.model_name,
|
||
description = EXCLUDED.description,
|
||
context_length = EXCLUDED.context_length,
|
||
pricing_input = EXCLUDED.pricing_input,
|
||
pricing_output = EXCLUDED.pricing_output,
|
||
updated_at = CURRENT_TIMESTAMP;
|
||
|
||
|
||
|