Render markdown in gist and project sidebar titles; add content visibility and GIF picker
DevPlace CI / test (push) Failing after 1h5m29s
DevPlace CI / test (push) Failing after 1h5m29s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,10 @@ from devplacepy.database import (
|
||||
sync_local_cache,
|
||||
)
|
||||
from devplacepy.services.openai_gateway import muse_code, opencode_zen
|
||||
from devplacepy.services.openai_gateway.tool_emulation import (
|
||||
TOOLS_MODE_NATIVE,
|
||||
TOOLS_MODES,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -205,6 +209,8 @@ MODEL_HEALTH_COLUMNS = (
|
||||
"health_checked_at",
|
||||
)
|
||||
|
||||
MODEL_TOOLS_COLUMN = "tools_mode"
|
||||
|
||||
HEALTH_OK = "ok"
|
||||
HEALTH_BAD = "bad"
|
||||
|
||||
@@ -241,6 +247,7 @@ def ensure_tables() -> None:
|
||||
"is_active INTEGER DEFAULT 1, health_status TEXT DEFAULT '', "
|
||||
"health_code TEXT DEFAULT '', health_message TEXT DEFAULT '', "
|
||||
"health_checked_at TEXT DEFAULT '', "
|
||||
"tools_mode TEXT DEFAULT 'native', "
|
||||
"created_at TEXT, updated_at TEXT)"
|
||||
)
|
||||
models_table = get_table(MODELS_TABLE)
|
||||
@@ -252,6 +259,8 @@ def ensure_tables() -> None:
|
||||
for column in MODEL_HEALTH_COLUMNS:
|
||||
if not models_table.has_column(column):
|
||||
models_table.create_column_by_example(column, "")
|
||||
if not models_table.has_column(MODEL_TOOLS_COLUMN):
|
||||
models_table.create_column_by_example(MODEL_TOOLS_COLUMN, TOOLS_MODE_NATIVE)
|
||||
try:
|
||||
db.query(
|
||||
"CREATE UNIQUE INDEX IF NOT EXISTS idx_gateway_providers_name ON "
|
||||
@@ -340,8 +349,17 @@ class ModelRouteIn(BaseModel):
|
||||
off_peak_end_minute: Optional[int] = Field(default=None, ge=0, le=1439)
|
||||
off_peak_discount_pct: float = Field(default=0.0, ge=0, le=100)
|
||||
fallback_model: str = Field(default="", max_length=128)
|
||||
tools_mode: str = Field(default=TOOLS_MODE_NATIVE, max_length=16)
|
||||
is_active: bool = True
|
||||
|
||||
@field_validator("tools_mode")
|
||||
@classmethod
|
||||
def _clean_tools_mode(cls, value: str) -> str:
|
||||
value = (value or TOOLS_MODE_NATIVE).strip().lower()
|
||||
if value not in TOOLS_MODES:
|
||||
raise ValueError(f"tools_mode must be one of: {', '.join(TOOLS_MODES)}")
|
||||
return value
|
||||
|
||||
@field_validator("source_model", "target_model")
|
||||
@classmethod
|
||||
def _clean_model(cls, value: str) -> str:
|
||||
@@ -407,6 +425,7 @@ class ModelRoute:
|
||||
health_code: str
|
||||
health_message: str
|
||||
health_checked_at: str
|
||||
tools_mode: str
|
||||
|
||||
|
||||
def _opt_float(row: dict, key: str) -> Optional[float]:
|
||||
@@ -448,6 +467,7 @@ def _route_from_row(row: dict) -> ModelRoute:
|
||||
health_code=str(row.get("health_code") or ""),
|
||||
health_message=str(row.get("health_message") or ""),
|
||||
health_checked_at=str(row.get("health_checked_at") or ""),
|
||||
tools_mode=str(row.get("tools_mode") or TOOLS_MODE_NATIVE),
|
||||
)
|
||||
|
||||
|
||||
@@ -579,6 +599,7 @@ class ModelStore:
|
||||
"off_peak_end_minute": payload.off_peak_end_minute,
|
||||
"off_peak_discount_pct": payload.off_peak_discount_pct,
|
||||
"fallback_model": payload.fallback_model,
|
||||
"tools_mode": payload.tools_mode,
|
||||
"is_active": 1 if payload.is_active else 0,
|
||||
"updated_at": _now(),
|
||||
}
|
||||
@@ -789,6 +810,7 @@ def chat_overlay(requested_model: Optional[str], base_cfg: dict) -> Optional[dic
|
||||
"gateway_off_peak_end_minute": route.off_peak_end_minute,
|
||||
"gateway_off_peak_discount_pct": route.off_peak_discount_pct,
|
||||
"gateway_provider_name": route.provider or "default",
|
||||
"gateway_tools_mode": route.tools_mode,
|
||||
}
|
||||
if route.provider:
|
||||
_provider_overlay(
|
||||
|
||||
Reference in New Issue
Block a user