Refactor search modes and optimize embedding generation

- Updated the dashboard template to hide the Code Graph Explorer feature.
- Enhanced the `executeCodexLens` function to use `exec` for better cross-platform compatibility and improved command execution.
- Changed the default `maxResults` and `limit` parameters in the smart search tool to 10 for better performance.
- Introduced a new `priority` search mode in the smart search tool, replacing the previous `parallel` mode, which now follows a fallback strategy: hybrid -> exact -> ripgrep.
- Optimized the embedding generation process in the embedding manager by batching operations and using a cached embedder instance to reduce model loading overhead.
- Implemented a thread-safe singleton pattern for the embedder to improve performance across multiple searches.
This commit is contained in:
catlog22
2025-12-20 11:08:34 +08:00
parent 7adde91e9f
commit e1cac5dd50
16 changed files with 852 additions and 284 deletions

View File

@@ -224,6 +224,13 @@
border-radius: 8px;
padding: 1.25rem;
transition: all 0.2s ease;
cursor: pointer;
/* Fixed card dimensions */
display: flex;
flex-direction: column;
height: 280px;
min-height: 280px;
max-height: 280px;
}
.memory-card:hover {
@@ -239,8 +246,9 @@
.memory-card-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 1rem;
align-items: center;
margin-bottom: 0.75rem;
flex-shrink: 0;
}
.memory-id {
@@ -248,7 +256,8 @@
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
color: hsl(var(--muted-foreground));
color: hsl(var(--foreground));
font-weight: 600;
flex-wrap: wrap;
}
@@ -257,6 +266,10 @@
height: 16px;
}
.memory-id i[data-lucide="star"] {
color: hsl(38 92% 50%);
}
.memory-actions {
display: flex;
gap: 0.5rem;
@@ -282,34 +295,83 @@
color: hsl(var(--destructive));
}
.icon-btn.favorite-active {
color: hsl(38 92% 50%);
}
.icon-btn.favorite-active:hover {
color: hsl(38 92% 40%);
}
.icon-btn i {
width: 18px;
height: 18px;
}
/* Copy ID Button */
.copy-id-btn {
background: none;
border: none;
padding: 0.125rem 0.25rem;
cursor: pointer;
color: hsl(var(--muted-foreground));
transition: color 0.2s;
display: inline-flex;
align-items: center;
justify-content: center;
margin-left: 0.25rem;
border-radius: 4px;
}
.copy-id-btn:hover {
color: hsl(var(--primary));
background: hsl(var(--muted));
}
.copy-id-btn i {
width: 14px;
height: 14px;
}
.copy-id-btn.copied {
color: hsl(var(--success, 142 76% 36%));
}
/* Memory Content */
.memory-content {
margin-bottom: 1rem;
}
.memory-summary {
font-size: 0.9375rem;
line-height: 1.6;
color: hsl(var(--foreground));
flex: 1;
min-height: 0;
overflow: hidden;
margin-bottom: 0.75rem;
}
.memory-summary,
.memory-preview {
font-size: 0.875rem;
line-height: 1.5;
color: hsl(var(--muted-foreground));
/* Fixed height with ellipsis */
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
max-height: 6em;
}
.memory-summary {
color: hsl(var(--foreground));
}
/* Memory Tags */
.memory-tags {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-bottom: 1rem;
gap: 0.375rem;
margin-bottom: 0.5rem;
flex-shrink: 0;
max-height: 2rem;
overflow: hidden;
}
.tag {
@@ -321,13 +383,14 @@
font-weight: 500;
}
/* Memory Footer */
/* Memory Footer - Fixed at bottom */
.memory-footer {
display: flex;
flex-direction: column;
gap: 0.75rem;
padding-top: 1rem;
gap: 0.5rem;
padding-top: 0.75rem;
border-top: 1px solid hsl(var(--border));
margin-top: auto;
}
.memory-meta {
@@ -850,6 +913,89 @@
margin: 0;
}
/* Relations Detail Styles */
.relations-detail h4 {
font-size: 1rem;
font-weight: 600;
margin-bottom: 1rem;
color: hsl(var(--foreground));
}
.clusters-list {
display: flex;
flex-direction: column;
gap: 1rem;
}
.relation-cluster-item {
padding: 1rem;
background: hsl(var(--muted) / 0.3);
border: 1px solid hsl(var(--border));
border-radius: 8px;
}
.relation-cluster-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.75rem;
}
.relation-cluster-header i {
width: 18px;
height: 18px;
color: hsl(var(--primary));
}
.relation-cluster-header .cluster-name {
font-weight: 600;
color: hsl(var(--foreground));
}
.cluster-relations-list {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5rem;
padding-top: 0.75rem;
border-top: 1px solid hsl(var(--border));
}
.relations-label {
font-size: 0.8125rem;
color: hsl(var(--muted-foreground));
}
.relation-tag {
display: inline-flex;
align-items: center;
gap: 0.375rem;
padding: 0.25rem 0.625rem;
background: hsl(var(--accent));
border-radius: 4px;
font-size: 0.8125rem;
}
.relation-tag i {
width: 12px;
height: 12px;
color: hsl(var(--muted-foreground));
}
.relation-tag .relation-type {
font-size: 0.6875rem;
padding: 0.125rem 0.375rem;
background: hsl(var(--primary) / 0.15);
color: hsl(var(--primary));
border-radius: 3px;
margin-left: 0.25rem;
}
.text-muted {
color: hsl(var(--muted-foreground));
font-size: 0.875rem;
}
/* Dark Mode Adjustments */
[data-theme="dark"] .memory-card {
background: #1e293b;