init dialectic

This commit is contained in:
h z
2026-02-13 15:44:25 +00:00
commit 24a75d4fc2
13 changed files with 191 additions and 0 deletions

16
.env Normal file
View File

@@ -0,0 +1,16 @@
# Frontend
FRONTEND_PORT=3000
# Backend
BACKEND_PORT=8090
BACKEND_URL=http://localhost:8090
# Database
DB_PORT=3306
MYSQL_ROOT_PASSWORD=rootpassword
MYSQL_DATABASE=dialectic
MYSQL_USER=dialectic
MYSQL_PASSWORD=dialectic
# Backend internal
ENCRYPTION_KEY=BgS9_9K2UMYxiYnP-BE63UEdi7a6PHaaZ6rQZQnSx54=

10
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

15
.idea/Dialectic.iml generated Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="py.test" />
</component>
</module>

17
.idea/aws.xml generated Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="accountSettings">
<option name="activeProfile" value="profile:default" />
<option name="activeRegion" value="eu-west-2" />
<option name="recentlyUsedProfiles">
<list>
<option value="profile:default" />
</list>
</option>
<option name="recentlyUsedRegions">
<list>
<option value="eu-west-2" />
</list>
</option>
</component>
</project>

4
.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.13" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Dialectic.iml" filepath="$PROJECT_DIR$/.idea/Dialectic.iml" />
</modules>
</component>
</project>

8
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/Dialectic.Backend" vcs="Git" />
<mapping directory="$PROJECT_DIR$/Dialectic.Frontend" vcs="Git" />
</component>
</project>

1
Dialectic.Backend Submodule

Submodule Dialectic.Backend added at 83c4461d29

1
Dialectic.Frontend Submodule

Submodule Dialectic.Frontend added at 16630b6999

51
docker-compose.yaml Normal file
View File

@@ -0,0 +1,51 @@
services:
frontend:
build:
context: ./Dialectic.Frontend
dockerfile: Dockerfile
ports:
- "${FRONTEND_PORT:-3000}:3000"
environment:
- NODE_ENV=development
- REACT_APP_BACKEND_HOST=${BACKEND_URL:-http://localhost:8000}
stdin_open: true
tty: true
backend:
build:
context: ./Dialectic.Backend
dockerfile: Dockerfile
ports:
- "${BACKEND_PORT:-8000}:8000"
volumes:
- dialectic_config:/app/config
environment:
- ENV_MODE=prod
- ENCRYPTION_KEY=${ENCRYPTION_KEY:-BgS9_9K2UMYxiYnP-BE63UEdi7a6PHaaZ6rQZQnSx54=}
- CONFIG_PATH=/app/config/dialectic.yaml
depends_on:
db:
condition: service_healthy
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
db:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootpassword}
MYSQL_DATABASE: ${MYSQL_DATABASE:-dialectic}
MYSQL_USER: ${MYSQL_USER:-dialectic}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-dialectic}
ports:
- "${DB_PORT:-3306}:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
volumes:
mysql_data:
dialectic_config:

47
init.sql Normal file
View File

@@ -0,0 +1,47 @@
-- MySQL initialization script for Dialectic
CREATE DATABASE IF NOT EXISTS dialectic;
USE dialectic;
-- Table for storing API keys for different providers
CREATE TABLE IF NOT EXISTS api_keys (
id INT AUTO_INCREMENT PRIMARY KEY,
provider VARCHAR(50) NOT NULL UNIQUE,
api_key_encrypted TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- Table for storing model configurations
CREATE TABLE IF NOT EXISTS model_configs (
id INT AUTO_INCREMENT PRIMARY KEY,
provider VARCHAR(50) NOT NULL,
model_name VARCHAR(100) NOT NULL,
display_name VARCHAR(100),
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY unique_provider_model (provider, model_name)
);
-- Insert default API key records (encrypted field will be empty initially)
INSERT IGNORE INTO api_keys (provider, api_key_encrypted) VALUES
('openai', ''),
('claude', ''),
('qwen', ''),
('deepseek', '');
-- Insert default model configurations
INSERT IGNORE INTO model_configs (provider, model_name, display_name) VALUES
('openai', 'gpt-4', 'GPT-4'),
('openai', 'gpt-3.5-turbo', 'GPT-3.5 Turbo'),
('claude', 'claude-3-opus', 'Claude 3 Opus'),
('claude', 'claude-3-sonnet', 'Claude 3 Sonnet'),
('claude', 'claude-3-haiku', 'Claude 3 Haiku'),
('qwen', 'qwen-max', 'Qwen Max'),
('qwen', 'qwen-plus', 'Qwen Plus'),
('deepseek', 'deepseek-chat', 'DeepSeek Chat'),
('deepseek', 'deepseek-coder', 'DeepSeek Coder');
-- Add evidence_library column to debate_sessions (migration for existing databases)
ALTER TABLE debate_sessions ADD COLUMN IF NOT EXISTS evidence_library TEXT NULL;