chore: 简化部分代码

This commit is contained in:
ViperEkura 2026-04-15 10:27:56 +08:00
parent d684dbef40
commit ad3262dd5c
5 changed files with 42 additions and 16 deletions

View File

@ -601,3 +601,42 @@ select[aria-expanded="true"] {
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 1rem; gap: 1rem;
} }
/* ============ Switch Toggle ============ */
.switch {
position: relative;
display: inline-block;
width: 40px;
height: 22px;
flex-shrink: 0;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
inset: 0;
background-color: #ccc;
transition: 0.3s;
border-radius: 22px;
}
.slider:before {
position: absolute;
content: "";
height: 16px;
width: 16px;
left: 3px;
bottom: 3px;
background-color: white;
transition: 0.3s;
border-radius: 50%;
}
input:checked + .slider {
background-color: var(--accent-primary);
}
input:checked + .slider:before {
transform: translateX(18px);
}

View File

@ -561,13 +561,7 @@ textarea { width: 100%; padding: 0.75rem; border: 1px solid var(--border-input);
.info-item { font-size: 0.8rem; color: var(--text-primary); word-break: break-all; } .info-item { font-size: 0.8rem; color: var(--text-primary); word-break: break-all; }
.info-item.sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.2rem; } .info-item.sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.2rem; }
/* 开关 */ /* 开关样式已移至全局 style.css */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: #ccc; transition: 0.3s; border-radius: 22px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: 0.3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent-primary); }
input:checked + .slider:before { transform: translateX(18px); }
/* 操作按钮 */ /* 操作按钮 */
.ops-buttons { display: flex; flex-wrap: nowrap; gap: 0.5rem; } .ops-buttons { display: flex; flex-wrap: nowrap; gap: 0.5rem; }

View File

@ -110,12 +110,7 @@ onMounted(fetchData)
.params-col { width: 30%; } .params-col { width: 30%; }
.param-tag { display: inline-block; padding: 0.2rem 0.5rem; background: var(--bg-code); border-radius: 4px; font-size: 0.75rem; color: var(--text-secondary); margin: 0.15rem; } .param-tag { display: inline-block; padding: 0.2rem 0.5rem; background: var(--bg-code); border-radius: 4px; font-size: 0.75rem; color: var(--text-secondary); margin: 0.15rem; }
.switch-col { text-align: center; } .switch-col { text-align: center; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; } /* switch 样式已移至全局 style.css */
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: #ccc; transition: 0.3s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: 0.3s; border-radius: 50%; }
input:checked + .slider { background-color: #16a34a; }
input:checked + .slider:before { transform: translateX(20px); }
.loading { text-align: center; padding: 4rem; } .loading { text-align: center; padding: 4rem; }
.error-msg { text-align: center; padding: 2rem; color: var(--accent-primary); background: var(--accent-primary-light); border-radius: 12px; } .error-msg { text-align: center; padding: 2rem; color: var(--accent-primary); background: var(--accent-primary-light); border-radius: 12px; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border-light); border-top-color: var(--accent-primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 1rem; } .spinner { width: 40px; height: 40px; border: 3px solid var(--border-light); border-top-color: var(--accent-primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 1rem; }

View File

@ -83,8 +83,7 @@ def send_message(
) )
db.add(user_message) db.add(user_message)
from datetime import datetime, timezone, timedelta conversation.updated_at = datetime.now()
conversation.updated_at = datetime.now(timezone(timedelta(hours=8)))
response = chat_service.non_stream_response( response = chat_service.non_stream_response(
conversation=conversation, conversation=conversation,

View File

@ -20,7 +20,6 @@ def list_tools(
): ):
"""Get available tools list""" """Get available tools list"""
# Get tool definitions directly from registry to access category # Get tool definitions directly from registry to access category
from luxx.tools.core import ToolDefinition
if category: if category:
all_tools = [t for t in registry._tools.values() if t.category == category] all_tools = [t for t in registry._tools.values() if t.category == category]