feat: Enhance configuration management and embedding capabilities

- Added JSON-based settings management in Config class for embedding and LLM configurations.
- Introduced methods to save and load settings from a JSON file.
- Updated BaseEmbedder and its subclasses to include max_tokens property for better token management.
- Enhanced chunking strategy to support recursive splitting of large symbols with improved overlap handling.
- Implemented comprehensive tests for recursive splitting and chunking behavior.
- Added CLI tools configuration management for better integration with external tools.
- Introduced a new command for compacting session memory into structured text for recovery.
This commit is contained in:
catlog22
2025-12-24 16:32:27 +08:00
parent b00113d212
commit e671b45948
25 changed files with 2889 additions and 153 deletions

View File

@@ -622,11 +622,110 @@ select.cli-input {
align-items: center;
justify-content: flex-end;
gap: 0.75rem;
margin-top: 1rem;
padding-top: 1rem;
margin-top: 1.25rem;
padding-top: 1.25rem;
border-top: 1px solid hsl(var(--border));
}
.modal-actions button {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0.625rem 1.25rem;
font-size: 0.875rem;
font-weight: 500;
border-radius: 0.5rem;
cursor: pointer;
transition: all 0.2s ease;
min-width: 5rem;
}
.modal-actions .btn-secondary {
background: transparent;
border: 1px solid hsl(var(--border));
color: hsl(var(--muted-foreground));
}
.modal-actions .btn-secondary:hover {
background: hsl(var(--muted));
color: hsl(var(--foreground));
border-color: hsl(var(--muted-foreground) / 0.3);
}
.modal-actions .btn-primary {
background: hsl(var(--primary));
border: 1px solid hsl(var(--primary));
color: hsl(var(--primary-foreground));
}
.modal-actions .btn-primary:hover {
background: hsl(var(--primary) / 0.9);
box-shadow: 0 2px 8px hsl(var(--primary) / 0.3);
}
.modal-actions .btn-primary:disabled {
opacity: 0.5;
cursor: not-allowed;
box-shadow: none;
}
.modal-actions .btn-danger {
background: hsl(var(--destructive));
border: 1px solid hsl(var(--destructive));
color: hsl(var(--destructive-foreground));
}
.modal-actions .btn-danger:hover {
background: hsl(var(--destructive) / 0.9);
box-shadow: 0 2px 8px hsl(var(--destructive) / 0.3);
}
.modal-actions button i,
.modal-actions button svg {
width: 1rem;
height: 1rem;
flex-shrink: 0;
}
/* Handle .btn class prefix */
.modal-actions .btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0.625rem 1.25rem;
font-size: 0.875rem;
font-weight: 500;
border-radius: 0.5rem;
cursor: pointer;
transition: all 0.2s ease;
min-width: 5rem;
}
.modal-actions .btn.btn-secondary {
background: transparent;
border: 1px solid hsl(var(--border));
color: hsl(var(--muted-foreground));
}
.modal-actions .btn.btn-secondary:hover {
background: hsl(var(--muted));
color: hsl(var(--foreground));
border-color: hsl(var(--muted-foreground) / 0.3);
}
.modal-actions .btn.btn-primary {
background: hsl(var(--primary));
border: 1px solid hsl(var(--primary));
color: hsl(var(--primary-foreground));
}
.modal-actions .btn.btn-primary:hover {
background: hsl(var(--primary) / 0.9);
box-shadow: 0 2px 8px hsl(var(--primary) / 0.3);
}
/* Button Icon */
.btn-icon {
display: inline-flex;
@@ -1916,4 +2015,84 @@ select.cli-input {
.health-check-grid {
grid-template-columns: 1fr;
}
}
/* ===========================
Model Settings Modal - Endpoint Preview
=========================== */
.endpoint-preview-section {
background: hsl(var(--muted) / 0.3);
border: 1px solid hsl(var(--border));
border-radius: 0.5rem;
padding: 1rem;
margin-bottom: 0.5rem;
}
.endpoint-preview-section h4 {
display: flex;
align-items: center;
gap: 0.5rem;
margin: 0 0 0.75rem 0;
font-size: 0.875rem;
font-weight: 600;
color: hsl(var(--foreground));
}
.endpoint-preview-section h4 i {
width: 16px;
height: 16px;
color: hsl(var(--primary));
}
.endpoint-preview-box {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.625rem 0.75rem;
background: hsl(var(--background));
border: 1px solid hsl(var(--border));
border-radius: 0.375rem;
margin-bottom: 1rem;
}
.endpoint-preview-box code {
flex: 1;
font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
font-size: 0.8125rem;
color: hsl(var(--primary));
word-break: break-all;
}
.endpoint-preview-box .btn-icon-sm {
flex-shrink: 0;
}
/* Form Section within Modal */
.form-section {
margin-bottom: 1.25rem;
}
.form-section h4 {
margin: 0 0 0.75rem 0;
font-size: 0.8125rem;
font-weight: 600;
color: hsl(var(--muted-foreground));
text-transform: uppercase;
letter-spacing: 0.05em;
}
.form-section:last-of-type {
margin-bottom: 0;
}
/* Capabilities Checkboxes */
.capabilities-checkboxes {
display: flex;
flex-wrap: wrap;
gap: 0.75rem 1.5rem;
}
.capabilities-checkboxes .checkbox-label {
font-size: 0.875rem;
}