fix(desktop): 替换 require() 为 ES import — 修复生产构建崩溃
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- connectionStore: 2 处 require() → loadConversationStore() 异步预加载 + 闭包引用 - saasStore: 1 处 require() → await import()(logout 是 async) - llm-service: 1 处 require() → 顶层 import(无循环依赖) - streamStore: 移除重复动态导入,统一使用顶层 useConnectionStore - tsc --noEmit 0 errors
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
import { DEFAULT_MODEL_ID, DEFAULT_OPENAI_BASE_URL } from '../constants/models';
|
||||
import { createLogger } from './logger';
|
||||
import { recordLLMUsage } from './telemetry-collector';
|
||||
|
||||
const log = createLogger('LLMService');
|
||||
|
||||
@@ -819,7 +820,6 @@ function trackLLMCall(
|
||||
error?: unknown,
|
||||
): void {
|
||||
try {
|
||||
const { recordLLMUsage } = require('./telemetry-collector');
|
||||
recordLLMUsage(
|
||||
response.model || adapter.getProvider(),
|
||||
response.tokensUsed?.input ?? 0,
|
||||
@@ -832,7 +832,7 @@ function trackLLMCall(
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
log.debug('Telemetry recording failed (SSR or unavailable)', { error: e });
|
||||
log.debug('Telemetry recording failed', { error: e });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user