feat: 添加高可用性模型池支持,优化路径解析功能

This commit is contained in:
catlog22
2026-01-08 23:54:32 +08:00
parent 84168825d6
commit 30ff742310
3 changed files with 68 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ export interface ValidatePathOptions {
/**
* Resolve a path, handling ~ for home directory
* Also handles Windows drive-relative paths (e.g., "D:path" -> "D:\path")
* @param inputPath - Path to resolve
* @returns Absolute path
*/
@@ -34,6 +35,17 @@ export function resolvePath(inputPath: string): string {
return join(homedir(), inputPath.slice(1));
}
// Handle Windows drive-relative paths (e.g., "D:path" without backslash)
// Pattern: single letter followed by colon, then immediately a non-slash character
// This converts "D:path" to "D:\path" to make it absolute
if (process.platform === 'win32' || /^[a-zA-Z]:/.test(inputPath)) {
const driveRelativeMatch = inputPath.match(/^([a-zA-Z]:)([^/\\].*)$/);
if (driveRelativeMatch) {
// Insert backslash after drive letter
inputPath = driveRelativeMatch[1] + '\\' + driveRelativeMatch[2];
}
}
return resolve(inputPath);
}