mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-09 12:17:24 -04:00
Compare commits
6 Commits
v0.3.0-alp
...
v0.3.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 71ec53db45 | |||
| b6bd949d23 | |||
| b5f18ac0f3 | |||
| 90b6ad400d | |||
| 6e4b2a4cc5 | |||
| 18bd4d169d |
@@ -116,7 +116,7 @@ class HealthResponse(BaseModel):
|
|||||||
|
|
||||||
def create_app(
|
def create_app(
|
||||||
db_path: str = "data/jobs.db",
|
db_path: str = "data/jobs.db",
|
||||||
config_path: str = "configs/default_config.json"
|
config_path: str = "/tmp/runtime_config.json" if Path("/tmp/runtime_config.json").exists() else "configs/default_config.json"
|
||||||
) -> FastAPI:
|
) -> FastAPI:
|
||||||
"""
|
"""
|
||||||
Create FastAPI application instance.
|
Create FastAPI application instance.
|
||||||
@@ -525,10 +525,12 @@ app = create_app()
|
|||||||
# Ensure database is initialized when module is loaded
|
# Ensure database is initialized when module is loaded
|
||||||
# This handles cases where lifespan might not be triggered properly
|
# This handles cases where lifespan might not be triggered properly
|
||||||
logger.info("🔧 Module-level database initialization check...")
|
logger.info("🔧 Module-level database initialization check...")
|
||||||
|
|
||||||
from tools.deployment_config import is_dev_mode, get_db_path
|
from tools.deployment_config import is_dev_mode, get_db_path
|
||||||
from api.database import initialize_dev_database, initialize_database
|
from api.database import initialize_dev_database, initialize_database
|
||||||
|
|
||||||
_db_path = app.state.db_path
|
_db_path = app.state.db_path
|
||||||
|
|
||||||
if is_dev_mode():
|
if is_dev_mode():
|
||||||
logger.info(" 🔧 DEV mode - initializing dev database at module load")
|
logger.info(" 🔧 DEV mode - initializing dev database at module load")
|
||||||
_dev_db_path = get_db_path(_db_path)
|
_dev_db_path = get_db_path(_db_path)
|
||||||
@@ -536,6 +538,7 @@ if is_dev_mode():
|
|||||||
else:
|
else:
|
||||||
logger.info(" 🏭 PROD mode - ensuring database exists at module load")
|
logger.info(" 🏭 PROD mode - ensuring database exists at module load")
|
||||||
initialize_database(_db_path)
|
initialize_database(_db_path)
|
||||||
|
|
||||||
logger.info("✅ Module-level database initialization complete")
|
logger.info("✅ Module-level database initialization complete")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,30 +6,28 @@
|
|||||||
},
|
},
|
||||||
"models": [
|
"models": [
|
||||||
{
|
{
|
||||||
"name": "claude-3.7-sonnet",
|
"name": "claude-sonnet-4-5",
|
||||||
"basemodel": "anthropic/claude-3.7-sonnet",
|
"basemodel": "anthropic/claude-sonnet-4.5",
|
||||||
"signature": "claude-3.7-sonnet",
|
"signature": "claude-sonnet-4.5",
|
||||||
"enabled": false,
|
"enabled": true
|
||||||
"openai_base_url": "Optional: YOUR_OPENAI_BASE_URL,you can write them in .env file",
|
|
||||||
"openai_api_key": "Optional: YOUR_OPENAI_API_KEY,you can write them in .env file"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "deepseek-chat-v3.1",
|
"name": "deepseek-chat-v3.1",
|
||||||
"basemodel": "deepseek/deepseek-chat-v3.1",
|
"basemodel": "deepseek/deepseek-chat-v3.1",
|
||||||
"signature": "deepseek-chat-v3.1",
|
"signature": "deepseek-chat-v3.1",
|
||||||
"enabled": false
|
"enabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "qwen3-max",
|
"name": "qwen3-max",
|
||||||
"basemodel": "qwen/qwen3-max",
|
"basemodel": "qwen/qwen3-max",
|
||||||
"signature": "qwen3-max",
|
"signature": "qwen3-max",
|
||||||
"enabled": false
|
"enabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gemini-2.5-flash",
|
"name": "gemini-2.5-flash",
|
||||||
"basemodel": "google/gemini-2.5-flash",
|
"basemodel": "google/gemini-2.5-flash",
|
||||||
"signature": "gemini-2.5-flash",
|
"signature": "gemini-2.5-flash",
|
||||||
"enabled": false
|
"enabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gpt-5",
|
"name": "gpt-5",
|
||||||
|
|||||||
@@ -69,8 +69,16 @@ def get_db_path(base_db_path: str) -> str:
|
|||||||
Example:
|
Example:
|
||||||
PROD: "data/trading.db" -> "data/trading.db"
|
PROD: "data/trading.db" -> "data/trading.db"
|
||||||
DEV: "data/trading.db" -> "data/trading_dev.db"
|
DEV: "data/trading.db" -> "data/trading_dev.db"
|
||||||
|
|
||||||
|
Note:
|
||||||
|
This function is idempotent - calling it multiple times on the same
|
||||||
|
path will not add multiple _dev suffixes.
|
||||||
"""
|
"""
|
||||||
if is_dev_mode():
|
if is_dev_mode():
|
||||||
|
# Check if already has _dev suffix (idempotent)
|
||||||
|
if "_dev.db" in base_db_path:
|
||||||
|
return base_db_path
|
||||||
|
|
||||||
# Insert _dev before .db extension
|
# Insert _dev before .db extension
|
||||||
if base_db_path.endswith(".db"):
|
if base_db_path.endswith(".db"):
|
||||||
return base_db_path[:-3] + "_dev.db"
|
return base_db_path[:-3] + "_dev.db"
|
||||||
|
|||||||
Reference in New Issue
Block a user