feat: Add unified LiteLLM API management with dashboard UI and CLI integration

- Create ccw-litellm Python package with AbstractEmbedder and AbstractLLMClient interfaces
- Add BaseEmbedder abstraction and factory pattern to codex-lens for pluggable backends
- Implement API Settings dashboard page for provider credentials and custom endpoints
- Add REST API routes for CRUD operations on providers and endpoints
- Extend CLI with --model parameter for custom endpoint routing
- Integrate existing context-cache for @pattern file resolution
- Add provider model registry with predefined models per provider type
- Include i18n translations (en/zh) for all new UI elements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-12-23 20:36:32 +08:00
parent 5228581324
commit bf66b095c7
44 changed files with 4948 additions and 19 deletions

View File

@@ -0,0 +1,397 @@
/* ========================================
* API Settings Styles
* ======================================== */
/* Main Container */
.api-settings-container {
display: flex;
flex-direction: column;
gap: 1.5rem;
padding: 1rem;
}
/* Section Styles */
.api-settings-section {
background: hsl(var(--card));
border: 1px solid hsl(var(--border));
border-radius: 0.75rem;
padding: 1.25rem;
}
.section-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid hsl(var(--border));
}
.section-header h3 {
font-size: 1rem;
font-weight: 600;
color: hsl(var(--foreground));
margin: 0;
}
/* Settings List */
.api-settings-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
/* Settings Card */
.api-settings-card {
background: hsl(var(--background));
border: 1px solid hsl(var(--border));
border-radius: 0.5rem;
padding: 1rem;
transition: all 0.2s ease;
}
.api-settings-card:hover {
border-color: hsl(var(--primary) / 0.3);
box-shadow: 0 2px 8px hsl(var(--primary) / 0.1);
}
.api-settings-card.disabled {
opacity: 0.6;
background: hsl(var(--muted) / 0.3);
}
/* Card Header */
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 0.75rem;
}
.card-info {
display: flex;
align-items: center;
gap: 0.75rem;
flex: 1;
}
.card-info h4 {
font-size: 0.9375rem;
font-weight: 600;
color: hsl(var(--foreground));
margin: 0;
}
.card-actions {
display: flex;
align-items: center;
gap: 0.5rem;
}
/* Card Body */
.card-body {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.card-meta {
display: flex;
flex-wrap: wrap;
gap: 1rem;
font-size: 0.8125rem;
color: hsl(var(--muted-foreground));
}
.card-meta span {
display: flex;
align-items: center;
gap: 0.375rem;
}
.card-meta i {
font-size: 0.875rem;
}
/* Provider Type Badge */
.provider-type-badge {
display: inline-flex;
align-items: center;
padding: 0.25rem 0.625rem;
font-size: 0.6875rem;
font-weight: 600;
text-transform: uppercase;
background: hsl(var(--primary) / 0.1);
color: hsl(var(--primary));
border-radius: 9999px;
letter-spacing: 0.03em;
}
/* Endpoint ID */
.endpoint-id {
font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
font-size: 0.75rem;
padding: 0.25rem 0.5rem;
background: hsl(var(--muted) / 0.5);
border-radius: 0.25rem;
color: hsl(var(--primary));
}
/* Usage Hint */
.usage-hint {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.625rem 0.75rem;
background: hsl(var(--muted) / 0.3);
border-radius: 0.375rem;
font-size: 0.75rem;
color: hsl(var(--muted-foreground));
margin-top: 0.375rem;
}
.usage-hint code {
font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
font-size: 0.6875rem;
color: hsl(var(--foreground));
}
/* Status Badge */
.status-badge {
display: inline-flex;
align-items: center;
padding: 0.25rem 0.625rem;
font-size: 0.6875rem;
font-weight: 600;
border-radius: 9999px;
}
.status-badge.status-enabled {
background: hsl(142 76% 36% / 0.1);
color: hsl(142 76% 36%);
}
.status-badge.status-disabled {
background: hsl(var(--muted) / 0.5);
color: hsl(var(--muted-foreground));
}
/* Empty State */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 2.5rem 1rem;
text-align: center;
color: hsl(var(--muted-foreground));
}
.empty-icon {
font-size: 3rem;
opacity: 0.3;
margin-bottom: 0.75rem;
}
.empty-state p {
font-size: 0.875rem;
margin: 0;
}
/* Cache Settings Panel */
.cache-settings-panel {
padding: 1rem;
}
.cache-settings-content {
display: flex;
flex-direction: column;
gap: 1rem;
}
.cache-stats {
display: flex;
flex-direction: column;
gap: 0.75rem;
padding: 1rem;
background: hsl(var(--muted) / 0.3);
border-radius: 0.5rem;
}
.stat-item {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.8125rem;
}
.stat-label {
color: hsl(var(--muted-foreground));
font-weight: 500;
}
.stat-value {
color: hsl(var(--foreground));
font-weight: 600;
font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
}
/* Progress Bar */
.progress-bar {
width: 100%;
height: 8px;
background: hsl(var(--muted) / 0.5);
border-radius: 9999px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: hsl(var(--primary));
border-radius: 9999px;
transition: width 0.3s ease;
}
/* ========================================
* Form Styles
* ======================================== */
.api-settings-form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.form-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.form-group label {
font-size: 0.8125rem;
font-weight: 500;
color: hsl(var(--foreground));
}
.form-hint {
font-size: 0.75rem;
color: hsl(var(--muted-foreground));
font-style: italic;
}
.text-muted {
color: hsl(var(--muted-foreground));
font-weight: 400;
}
/* API Key Input Group */
.api-key-input-group {
display: flex;
gap: 0.5rem;
}
.api-key-input-group input {
flex: 1;
}
.api-key-input-group .btn-icon {
flex-shrink: 0;
}
/* Checkbox Label */
.checkbox-label {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.8125rem;
color: hsl(var(--foreground));
cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
width: 1rem;
height: 1rem;
cursor: pointer;
}
/* Fieldset */
.form-fieldset {
border: 1px solid hsl(var(--border));
border-radius: 0.5rem;
padding: 1rem;
margin: 0;
}
.form-fieldset legend {
font-size: 0.875rem;
font-weight: 600;
color: hsl(var(--foreground));
padding: 0 0.5rem;
}
/* Modal Actions */
.modal-actions {
display: flex;
gap: 0.75rem;
justify-content: flex-end;
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid hsl(var(--border));
}
/* ========================================
* Responsive Design
* ======================================== */
@media (min-width: 768px) {
.api-settings-container {
padding: 1.5rem;
}
.card-meta {
gap: 1.5rem;
}
}
@media (max-width: 640px) {
.section-header {
flex-direction: column;
align-items: flex-start;
gap: 0.75rem;
}
.card-header {
flex-direction: column;
align-items: flex-start;
gap: 0.75rem;
}
.card-actions {
align-self: flex-end;
}
.card-meta {
flex-direction: column;
gap: 0.5rem;
}
.modal-actions {
flex-direction: column;
}
.modal-actions .btn {
width: 100%;
}
}
/* Error Message */
.error-message {
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
font-size: 0.875rem;
color: hsl(var(--destructive));
text-align: center;
}