perf: index workflow route model lookup
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
CREATE INDEX IF NOT EXISTS token_routes_enabled_model_pattern_nocase_idx
|
||||||
|
ON token_routes (COALESCE(enabled, 1), model_pattern COLLATE NOCASE)
|
||||||
|
WHERE model_pattern IS NOT NULL
|
||||||
|
AND model_pattern <> '';
|
||||||
@@ -119,7 +119,7 @@ pub(super) fn is_chat_workflow_model(value: &str) -> bool {
|
|||||||
|
|
||||||
pub(super) async fn workflow_route_models(state: &AppState) -> AppResult<Vec<String>> {
|
pub(super) async fn workflow_route_models(state: &AppState) -> AppResult<Vec<String>> {
|
||||||
let rows = sqlx::query_scalar::<_, String>(
|
let rows = sqlx::query_scalar::<_, String>(
|
||||||
"SELECT DISTINCT model_pattern
|
"SELECT model_pattern
|
||||||
FROM token_routes
|
FROM token_routes
|
||||||
WHERE COALESCE(enabled, 1) = 1
|
WHERE COALESCE(enabled, 1) = 1
|
||||||
AND model_pattern IS NOT NULL
|
AND model_pattern IS NOT NULL
|
||||||
|
|||||||
Reference in New Issue
Block a user