generalbots/botmodels/src/core/config.py
Rodrigo Rodriguez 1a36f4aed2 fix: Embedding server auto-config and KB indexing fixes
- botserver/src/llm/local.rs:
  * Auto-configure embedding-url when empty (http://localhost:8082/v1/embeddings)
  * Auto-configure llm-url when empty (http://localhost:8081/v1/chat/completions)
  * Persist defaults to bot_configuration table via ConfigManager
  * Fix llama-server command path and add LD_LIBRARY_PATH
  * Fix working_dir for Linux (not just Windows)
  * Fix embedding server args: --embeddings --pooling mean --ctx-size 512

- botserver/src/core/bootstrap/bootstrap_manager.rs:
  * Temp disable alm-ci startup (causes 20s hang in bootstrap)
  * Remove unused alm_ci_health_check import

- Database changes:
  * bot_configuration.embedding-model: 'bge-small-en-v1.5-f32.gguf' (full filename)
  * bot_configuration.embedding-url: 'http://localhost:8082/v1/embeddings' (auto-generated)

- Testing:
  * Embedding server responds on port 8082
  * Generates 384-dimension embeddings
  * KB file exists: minio://default.gbai/default.gbkb/manual/test-kb-manual.txt
  * Next: Verify KB indexing and search functionality

Refs: #498
2026-04-28 14:27:00 -03:00

73 lines
2 KiB
Python

from pathlib import Path
from typing import Optional
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
case_sensitive=False,
extra="ignore",
)
env: str = "development"
host: str = "0.0.0.0"
port: int = 8085
log_level: str = "INFO"
api_v1_prefix: str = "/api"
project_name: str = "BotModels API"
version: str = "2.0.0"
api_key: str = "change-me"
commit: str = "unknown"
# External Providers for Speech (Optional)
groq_api_key: Optional[str] = None
openai_api_key: Optional[str] = None
# Image generation model
image_model_path: str = "./models/stable-diffusion-v1-5"
image_steps: int = 4
image_width: int = 512
image_height: int = 512
image_gpu_layers: int = 20
image_batch_size: int = 1
# Video generation model
video_model_path: str = "./models/zeroscope-v2"
video_frames: int = 24
video_fps: int = 8
video_width: int = 320
video_height: int = 576
video_gpu_layers: int = 15
video_batch_size: int = 1
# Speech/TTS model
speech_model_path: str = "./models/tts"
# Vision model (BLIP2 for captioning)
vision_model_path: str = "./models/blip2"
# Whisper model for speech-to-text
whisper_model_path: str = "./models/whisper"
# Real-time Audio model for speech-to-speech
realtime_audio_model_path: str = "./models/realtime_audio"
# Device configuration
device: str = "cuda"
# Output directory for generated files
output_dir: Path = Path("./outputs")
@property
def is_production(self) -> bool:
return self.env == "production"
settings = Settings()
settings.output_dir.mkdir(parents=True, exist_ok=True)
(settings.output_dir / "images").mkdir(exist_ok=True)
(settings.output_dir / "videos").mkdir(exist_ok=True)
(settings.output_dir / "audio").mkdir(exist_ok=True)