feat: Implement model description retrieval and update related API endpoints

This commit is contained in:
Will Miao
2025-08-27 18:22:56 +08:00
parent 9817bac2fe
commit 5b0becaaf2
8 changed files with 110 additions and 89 deletions

View File

@@ -970,4 +970,26 @@ export class BaseModelApiClient {
throw error;
}
}
async fetchModelDescription(filePath) {
try {
const params = new URLSearchParams({ file_path: filePath });
const response = await fetch(`${this.apiConfig.endpoints.modelDescription}?${params}`);
if (!response.ok) {
throw new Error(`Failed to fetch ${this.apiConfig.config.singularName} description: ${response.statusText}`);
}
const data = await response.json();
if (data.success) {
return data.description;
} else {
throw new Error(data.error || `No description found for ${this.apiConfig.config.singularName}`);
}
} catch (error) {
console.error(`Error fetching ${this.apiConfig.config.singularName} description:`, error);
throw error;
}
}
}