Add shared ai-service container as AI provider intermediary
All feature containers now POST messages to ai-service (port 8010) instead of calling AI providers directly. ai-service routes to LM Studio, Ollama, or Anthropic based on /config/ai_service_config.json. doc-service AI providers removed; replaced by httpx ai_client.py. Backend settings restructured to /api/settings/ai. Frontend gets dedicated AIAdminSettingsPage and AI Service card in AppsPage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import pytest
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
from app.main import app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def ai_client():
|
||||
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
|
||||
yield client
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Config fixtures
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
LMSTUDIO_CONFIG = {
|
||||
"provider": "lmstudio",
|
||||
"timeout_seconds": 10,
|
||||
"max_retries": 0,
|
||||
"lmstudio": {
|
||||
"base_url": "http://fake-lmstudio/v1",
|
||||
"model": "test-model",
|
||||
"api_key": "test-key",
|
||||
},
|
||||
}
|
||||
|
||||
OLLAMA_CONFIG = {
|
||||
"provider": "ollama",
|
||||
"timeout_seconds": 10,
|
||||
"max_retries": 0,
|
||||
"ollama": {
|
||||
"base_url": "http://fake-ollama/v1",
|
||||
"model": "llama3.2",
|
||||
"api_key": "ollama",
|
||||
},
|
||||
}
|
||||
|
||||
ANTHROPIC_CONFIG = {
|
||||
"provider": "anthropic",
|
||||
"timeout_seconds": 10,
|
||||
"max_retries": 0,
|
||||
"anthropic": {
|
||||
"api_key": "sk-ant-test",
|
||||
"model": "claude-haiku-4-5-20251001",
|
||||
},
|
||||
}
|
||||
|
||||
MISSING_KEY_ANTHROPIC_CONFIG = {
|
||||
"provider": "anthropic",
|
||||
"timeout_seconds": 10,
|
||||
"max_retries": 0,
|
||||
"anthropic": {
|
||||
"api_key": "",
|
||||
"model": "claude-haiku-4-5-20251001",
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user