mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
feat: 增加 Python 冷启动超时至 15 秒,并优化获取状态和配置的命令
This commit is contained in:
@@ -114,7 +114,8 @@ export class LiteLLMClient {
|
|||||||
*/
|
*/
|
||||||
async isAvailable(): Promise<boolean> {
|
async isAvailable(): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
await this.executePython(['version'], { timeout: 5000 });
|
// Increased timeout to 15s for Python cold start
|
||||||
|
await this.executePython(['version'], { timeout: 15000 });
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
@@ -126,10 +127,14 @@ export class LiteLLMClient {
|
|||||||
*/
|
*/
|
||||||
async getStatus(): Promise<LiteLLMStatus> {
|
async getStatus(): Promise<LiteLLMStatus> {
|
||||||
try {
|
try {
|
||||||
const output = await this.executePython(['version'], { timeout: 5000 });
|
// Increased timeout to 15s for Python cold start
|
||||||
|
const output = await this.executePython(['version'], { timeout: 15000 });
|
||||||
|
// Parse "ccw-litellm 0.1.0" format
|
||||||
|
const versionMatch = output.trim().match(/ccw-litellm\s+([\d.]+)/);
|
||||||
|
const version = versionMatch ? versionMatch[1] : output.trim();
|
||||||
return {
|
return {
|
||||||
available: true,
|
available: true,
|
||||||
version: output.trim()
|
version
|
||||||
};
|
};
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
return {
|
return {
|
||||||
@@ -143,7 +148,8 @@ export class LiteLLMClient {
|
|||||||
* Get current configuration
|
* Get current configuration
|
||||||
*/
|
*/
|
||||||
async getConfig(): Promise<any> {
|
async getConfig(): Promise<any> {
|
||||||
const output = await this.executePython(['config', '--json']);
|
// config command outputs JSON by default, no --json flag needed
|
||||||
|
const output = await this.executePython(['config']);
|
||||||
return JSON.parse(output);
|
return JSON.parse(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user