mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-16 23:07:14 +00:00
fix(ui): improve agent debug and model test feedback
This commit is contained in:
@@ -522,8 +522,9 @@ export default function ModelsPanel({
|
||||
setTestResult({ success: true, duration });
|
||||
} catch (err) {
|
||||
console.error('Failed to test model', err);
|
||||
toast.error(t('models.testError') + ': ' + (err as CustomApiError).msg);
|
||||
setTestResult(null);
|
||||
const message = (err as CustomApiError).msg || t('models.testError');
|
||||
toast.error(t('models.testError') + ': ' + message);
|
||||
setTestResult({ success: false, message });
|
||||
} finally {
|
||||
setIsTesting(false);
|
||||
}
|
||||
|
||||
@@ -437,6 +437,14 @@ export default function AddModelPopover({
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
{testResult?.success === false && (
|
||||
<p
|
||||
role="alert"
|
||||
className="rounded-md border border-destructive/30 bg-destructive/5 p-2 text-xs text-destructive [overflow-wrap:anywhere]"
|
||||
>
|
||||
{testResult.message}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@@ -412,6 +412,14 @@ export default function ModelItem({
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
{testResult?.success === false && (
|
||||
<p
|
||||
role="alert"
|
||||
className="rounded-md border border-destructive/30 bg-destructive/5 p-2 text-xs text-destructive [overflow-wrap:anywhere]"
|
||||
>
|
||||
{testResult.message}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
|
||||
@@ -27,10 +27,9 @@ export interface ProviderModels {
|
||||
rerank: RerankModel[];
|
||||
}
|
||||
|
||||
export interface TestResult {
|
||||
success: boolean;
|
||||
duration: number;
|
||||
}
|
||||
export type TestResult =
|
||||
| { success: true; duration: number }
|
||||
| { success: false; message: string };
|
||||
|
||||
export type SelectedScannedModel = {
|
||||
model: ScannedProviderModel;
|
||||
|
||||
Reference in New Issue
Block a user