mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-26 02:04:37 +08:00
refactor: remove dead code and simplify over-engineered abstractions
- Delete NotificationBus interface (no implementations, no callers) - Delete useAsyncData/useMultipleAsyncData composables (zero import sites) - Inline CHART_CAPABILITY_SKILL_ID into tool-catalog.ts (was a single-constant file) - Inline AsyncSqlExecutor into message-query-functions.ts (was a single-interface file) - Rename tools TimeFilter → ToolTimeRange to eliminate name collision with shared-types - Shrink useToast wrapper: two interfaces → one type, 40 lines → 17 lines - Simplify deepMerge: remove recursion, config is at most 1 level deep Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
835985fbf6
commit
39393cf38d
21 files changed
+79
-262
No files matched your search
@@ -148,14 +148,11 @@ export function writeConfigField(section: string, key: string, value: string | n
|
||||
fs.writeFileSync(CONFIG_TOML, lines.join('\n'), 'utf-8')
|
||||
}
|
||||
|
||||
/**
|
||||
* 简单的深度合并(仅处理纯对象,不处理数组)
|
||||
*/
|
||||
function deepMerge(base: Record<string, unknown>, override: Record<string, unknown>): Record<string, unknown> {
|
||||
const result = { ...base }
|
||||
for (const [key, value] of Object.entries(override)) {
|
||||
if (value !== undefined && value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
||||
result[key] = deepMerge((result[key] as Record<string, unknown>) ?? {}, value as Record<string, unknown>)
|
||||
if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
||||
result[key] = { ...(result[key] as object), ...(value as object) }
|
||||
} else if (value !== undefined) {
|
||||
result[key] = value
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user