mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-13 02:41:50 +08:00
feat: 委托 ensureLiteLLMEmbedderReady 以确保依赖一致性,优化 ccw-litellm 安装逻辑
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
|||||||
ensureUvInstalled,
|
ensureUvInstalled,
|
||||||
createCodexLensUvManager
|
createCodexLensUvManager
|
||||||
} from '../../utils/uv-manager.js';
|
} from '../../utils/uv-manager.js';
|
||||||
|
import { ensureLiteLLMEmbedderReady } from '../../tools/codex-lens.js';
|
||||||
import type { RouteContext } from './types.js';
|
import type { RouteContext } from './types.js';
|
||||||
|
|
||||||
// ========== Input Validation Schemas ==========
|
// ========== Input Validation Schemas ==========
|
||||||
@@ -105,43 +106,20 @@ export function clearCcwLitellmStatusCache() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Install ccw-litellm using UV package manager
|
* Install ccw-litellm using UV package manager
|
||||||
* Uses CodexLens venv for consistency with other Python dependencies
|
* Delegates to ensureLiteLLMEmbedderReady for consistent dependency handling
|
||||||
* @param packagePath - Local package path, or null to install from PyPI
|
* This ensures ccw-litellm installation doesn't break fastembed's onnxruntime dependencies
|
||||||
|
* @param _packagePath - Ignored, ensureLiteLLMEmbedderReady handles path discovery
|
||||||
* @returns Installation result
|
* @returns Installation result
|
||||||
*/
|
*/
|
||||||
async function installCcwLitellmWithUv(packagePath: string | null): Promise<{ success: boolean; message?: string; error?: string }> {
|
async function installCcwLitellmWithUv(_packagePath: string | null): Promise<{ success: boolean; message?: string; error?: string }> {
|
||||||
try {
|
// Delegate to the robust installation logic in codex-lens.ts
|
||||||
await ensureUvInstalled();
|
// This ensures consistent dependency handling within the shared venv,
|
||||||
|
// preventing onnxruntime conflicts that would break fastembed
|
||||||
// Reuse CodexLens venv for consistency
|
const result = await ensureLiteLLMEmbedderReady();
|
||||||
const uv = createCodexLensUvManager();
|
if (result.success) {
|
||||||
|
clearCcwLitellmStatusCache();
|
||||||
// Ensure venv exists
|
|
||||||
const venvResult = await uv.createVenv();
|
|
||||||
if (!venvResult.success) {
|
|
||||||
return { success: false, error: venvResult.error };
|
|
||||||
}
|
|
||||||
|
|
||||||
if (packagePath) {
|
|
||||||
// Install from local path
|
|
||||||
const result = await uv.installFromProject(packagePath);
|
|
||||||
if (result.success) {
|
|
||||||
clearCcwLitellmStatusCache();
|
|
||||||
return { success: true, message: 'ccw-litellm installed from local path via UV' };
|
|
||||||
}
|
|
||||||
return { success: false, error: result.error };
|
|
||||||
} else {
|
|
||||||
// Install from PyPI
|
|
||||||
const result = await uv.install(['ccw-litellm']);
|
|
||||||
if (result.success) {
|
|
||||||
clearCcwLitellmStatusCache();
|
|
||||||
return { success: true, message: 'ccw-litellm installed from PyPI via UV' };
|
|
||||||
}
|
|
||||||
return { success: false, error: result.error };
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
return { success: false, error: (err as Error).message };
|
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sanitizeProviderForResponse(provider: any): any {
|
function sanitizeProviderForResponse(provider: any): any {
|
||||||
|
|||||||
Reference in New Issue
Block a user