This commit is contained in:
2025-08-26 20:27:30 +02:00
parent 135e73691b
commit 994151374e
82 changed files with 10 additions and 148 deletions

View File

@@ -1,6 +1,12 @@
{
"extends": "next/core-web-vitals",
"rules": {
"no-console": [
"error",
{
"allow": []
}
],
"no-restricted-globals": [
"warn",
{

View File

@@ -58,7 +58,6 @@ export default function AdminPage() {
const statsData = await apiClient.get<SystemStats>("/api-internal/v1/settings/system-info");
setStats(statsData);
} catch (error) {
console.error("Failed to fetch system stats:", error);
}
// Fetch recent activity
@@ -66,10 +65,8 @@ export default function AdminPage() {
const activityData = await apiClient.get("/api-internal/v1/audit?page=1&size=10") as any;
setRecentActivity(activityData.logs || []);
} catch (error) {
console.error("Failed to fetch recent activity:", error);
}
} catch (error) {
console.error("Failed to fetch admin data:", error);
} finally {
setLoading(false);
}

View File

@@ -68,7 +68,6 @@ function AnalyticsPageContent() {
setData(analyticsData);
setLastUpdated(new Date());
} catch (error) {
console.error('Failed to fetch analytics:', error);
// Set empty data structure on error
setData({
overview: {

View File

@@ -157,7 +157,6 @@ export default function ApiKeysPage() {
const result = await apiClient.get("/api-internal/v1/api-keys") as any;
setApiKeys(result.api_keys || result.data || []);
} catch (error) {
console.error("Failed to fetch API keys:", error);
toast({
title: "Error",
description: "Failed to fetch API keys",
@@ -173,7 +172,6 @@ export default function ApiKeysPage() {
const result = await apiClient.get("/api-internal/v1/llm/models") as any;
setAvailableModels(result.data || []);
} catch (error) {
console.error("Failed to fetch models:", error);
setAvailableModels([]);
}
};
@@ -183,7 +181,6 @@ export default function ApiKeysPage() {
const result = await apiClient.get("/api-internal/v1/chatbot/list") as any;
setAvailableChatbots(result || []);
} catch (error) {
console.error("Failed to fetch chatbots:", error);
setAvailableChatbots([]);
}
};
@@ -214,7 +211,6 @@ export default function ApiKeysPage() {
await fetchApiKeys();
} catch (error) {
console.error("Failed to create API key:", error);
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to create API key",
@@ -237,7 +233,6 @@ export default function ApiKeysPage() {
await fetchApiKeys();
} catch (error) {
console.error("Failed to toggle API key:", error);
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to update API key",
@@ -262,7 +257,6 @@ export default function ApiKeysPage() {
setShowRegenerateDialog(null);
await fetchApiKeys();
} catch (error) {
console.error("Failed to regenerate API key:", error);
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to regenerate API key",
@@ -289,7 +283,6 @@ export default function ApiKeysPage() {
await fetchApiKeys();
} catch (error) {
console.error("Failed to delete API key:", error);
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to delete API key",
@@ -321,7 +314,6 @@ export default function ApiKeysPage() {
setEditKeyData({});
await fetchApiKeys();
} catch (error) {
console.error("Failed to update API key:", error);
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to update API key",

View File

@@ -7,7 +7,6 @@ export async function GET() {
const data = await handleProxyResponse(response, 'Failed to fetch analytics overview')
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching analytics overview:', error)
return NextResponse.json(
{ error: 'Failed to fetch analytics overview' },
{ status: 500 }

View File

@@ -7,7 +7,6 @@ export async function GET() {
const data = await handleProxyResponse(response, 'Failed to fetch analytics')
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching analytics:', error)
return NextResponse.json(
{ error: 'Failed to fetch analytics' },
{ status: 500 }

View File

@@ -12,7 +12,6 @@ export async function GET(request: NextRequest) {
const data = await handleProxyResponse(response, 'Failed to fetch audit logs')
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching audit logs:', error)
return NextResponse.json(
{ error: 'Failed to fetch audit logs' },
{ status: 500 }

View File

@@ -25,7 +25,6 @@ export async function POST(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error in auth login:', error)
return NextResponse.json(
{ error: 'Failed to process login' },
{ status: 500 }

View File

@@ -32,7 +32,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error in auth me:', error)
return NextResponse.json(
{ error: 'Failed to get user info' },
{ status: 500 }

View File

@@ -25,7 +25,6 @@ export async function POST(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error in auth refresh:', error)
return NextResponse.json(
{ error: 'Failed to refresh token' },
{ status: 500 }

View File

@@ -25,7 +25,6 @@ export async function POST(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error in auth register:', error)
return NextResponse.json(
{ error: 'Failed to process registration' },
{ status: 500 }

View File

@@ -141,7 +141,6 @@ export async function POST(request: NextRequest) {
message_id: messageId
})
} catch (error) {
console.error('Error in chat API route:', error)
return NextResponse.json(
{
error: 'Internal Server Error',

View File

@@ -32,7 +32,6 @@ export async function POST(request: NextRequest) {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error creating chatbot:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }

View File

@@ -29,7 +29,6 @@ export async function DELETE(
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error deleting chatbot:', error)
return NextResponse.json(
{ error: 'Failed to delete chatbot' },
{ status: 500 }

View File

@@ -29,7 +29,6 @@ export async function GET(request: NextRequest) {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching chatbots:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }

View File

@@ -22,7 +22,6 @@ export async function GET(request: NextRequest) {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching chatbot types:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }

View File

@@ -36,7 +36,6 @@ export async function PUT(
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error updating chatbot:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }

View File

@@ -32,7 +32,6 @@ export async function POST(
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error regenerating API key:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }

View File

@@ -31,7 +31,6 @@ export async function DELETE(
return NextResponse.json({ success: true })
} catch (error) {
console.error('Error deleting API key:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
@@ -72,7 +71,6 @@ export async function PUT(
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error updating API key:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }

View File

@@ -29,7 +29,6 @@ export async function GET(request: NextRequest) {
const data = await response.json()
return NextResponse.json({ data: data.api_keys })
} catch (error) {
console.error('Error fetching API keys:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
@@ -77,7 +76,6 @@ export async function POST(request: NextRequest) {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error creating API key:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }

View File

@@ -7,7 +7,6 @@ export async function GET() {
const data = await handleProxyResponse(response, 'Failed to fetch budget status')
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching budget status:', error)
return NextResponse.json(
{ error: 'Failed to fetch budget status' },
{ status: 500 }

View File

@@ -29,7 +29,6 @@ export async function GET(request: NextRequest) {
const data = await response.json()
return NextResponse.json({ data: data.budgets || [] })
} catch (error) {
console.error('Error fetching budgets:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }

View File

@@ -19,7 +19,6 @@ export async function POST(request: NextRequest) {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error in chat completions:', error)
return NextResponse.json(
{ error: 'Failed to process chat completion' },
{ status: 500 }

View File

@@ -36,7 +36,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json({ data: transformedModels })
} catch (error) {
console.error("Error fetching models:", error)
return NextResponse.json(
{ error: "Internal server error" },
{ status: 500 }

View File

@@ -26,7 +26,6 @@ export async function POST(
refreshRequired: true
})
} catch (error) {
console.error(`Error performing ${params.action} on module ${params.name}:`, error)
return NextResponse.json(
{ error: `Failed to ${params.action} module` },
{ status: 500 }

View File

@@ -17,7 +17,6 @@ export async function GET(
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error(`Error fetching config for module ${params.name}:`, error)
return NextResponse.json(
{ error: 'Failed to fetch module configuration' },
{ status: 500 }
@@ -54,7 +53,6 @@ export async function POST(
refreshRequired: true
})
} catch (error) {
console.error(`Error updating config for module ${params.name}:`, error)
return NextResponse.json(
{ error: 'Failed to update module configuration' },
{ status: 500 }

View File

@@ -25,7 +25,6 @@ export async function GET() {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching modules:', error)
return NextResponse.json(
{ error: 'Failed to fetch modules' },
{ status: 500 }

View File

@@ -12,7 +12,6 @@ export async function GET() {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching modules status:', error)
return NextResponse.json(
{ error: 'Failed to fetch modules status' },
{ status: 500 }

View File

@@ -29,7 +29,6 @@ export async function POST(request: NextRequest) {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error creating prompt template:', error)
return NextResponse.json(
{ error: 'Failed to create prompt template' },
{ status: 500 }

View File

@@ -29,7 +29,6 @@ export async function POST(request: NextRequest) {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error improving prompt with AI:', error)
return NextResponse.json(
{ error: 'Failed to improve prompt' },
{ status: 500 }

View File

@@ -32,7 +32,6 @@ export async function POST(
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error resetting prompt template:', error)
return NextResponse.json(
{ error: 'Failed to reset prompt template' },
{ status: 500 }

View File

@@ -35,7 +35,6 @@ export async function PUT(
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error updating prompt template:', error)
return NextResponse.json(
{ error: 'Failed to update prompt template' },
{ status: 500 }
@@ -73,7 +72,6 @@ export async function GET(
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching prompt template:', error)
return NextResponse.json(
{ error: 'Failed to fetch prompt template' },
{ status: 500 }

View File

@@ -25,7 +25,6 @@ export async function GET(request: NextRequest) {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching prompt templates:', error)
return NextResponse.json(
{ error: 'Failed to fetch prompt templates' },
{ status: 500 }

View File

@@ -25,7 +25,6 @@ export async function GET(request: NextRequest) {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching prompt variables:', error)
return NextResponse.json(
{ error: 'Failed to fetch prompt variables' },
{ status: 500 }

View File

@@ -32,7 +32,6 @@ export async function DELETE(
const data = await backendResponse.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error deleting collection:', error)
return NextResponse.json(
{ success: false, error: 'Failed to delete collection' },
{ status: 500 }
@@ -70,7 +69,6 @@ export async function GET(
const data = await backendResponse.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching collection:', error)
return NextResponse.json(
{ success: false, error: 'Failed to fetch collection' },
{ status: 500 }

View File

@@ -33,7 +33,6 @@ export async function GET(request: NextRequest) {
const data = await backendResponse.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching collections:', error)
return NextResponse.json(
{ success: false, error: 'Failed to fetch collections' },
{ status: 500 }
@@ -69,7 +68,6 @@ export async function POST(request: NextRequest) {
const data = await backendResponse.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error creating collection:', error)
return NextResponse.json(
{ success: false, error: 'Failed to create collection' },
{ status: 500 }

View File

@@ -49,7 +49,6 @@ export async function GET(
return new NextResponse(backendResponse.body, { headers })
} catch (error) {
console.error('Error downloading document:', error)
return NextResponse.json(
{ success: false, error: 'Failed to download document' },
{ status: 500 }

View File

@@ -32,7 +32,6 @@ export async function DELETE(
const data = await backendResponse.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error deleting document:', error)
return NextResponse.json(
{ success: false, error: 'Failed to delete document' },
{ status: 500 }
@@ -70,7 +69,6 @@ export async function GET(
const data = await backendResponse.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching document:', error)
return NextResponse.json(
{ success: false, error: 'Failed to fetch document' },
{ status: 500 }

View File

@@ -33,7 +33,6 @@ export async function GET(request: NextRequest) {
const data = await backendResponse.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching documents:', error)
return NextResponse.json(
{ success: false, error: 'Failed to fetch documents' },
{ status: 500 }
@@ -69,7 +68,6 @@ export async function POST(request: NextRequest) {
const data = await backendResponse.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error uploading document:', error)
return NextResponse.json(
{ success: false, error: 'Failed to upload document' },
{ status: 500 }

View File

@@ -27,7 +27,6 @@ export async function GET(request: NextRequest) {
const data = await backendResponse.json()
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching RAG stats:', error)
return NextResponse.json(
{ success: false, error: 'Failed to fetch RAG stats' },
{ status: 500 }

View File

@@ -42,7 +42,6 @@ export async function GET(request: NextRequest) {
}))
})
} catch (error) {
console.error('Error fetching chatbots:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }

View File

@@ -36,7 +36,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json({ data: transformedModels })
} catch (error) {
console.error("Error fetching models:", error)
return NextResponse.json(
{ error: "Internal server error" },
{ status: 500 }

View File

@@ -29,7 +29,6 @@ export async function GET(request: NextRequest) {
const data = await response.json()
return NextResponse.json(data)
} catch (error) {
console.error("Error fetching provider status:", error)
return NextResponse.json(
{ error: "Internal server error" },
{ status: 500 }

View File

@@ -37,7 +37,6 @@ export async function GET(
return NextResponse.json(data)
} catch (error) {
console.error('Error getting plugin config:', error)
return NextResponse.json(
{ error: 'Failed to get plugin config' },
{ status: 500 }
@@ -84,7 +83,6 @@ export async function POST(
return NextResponse.json(data)
} catch (error) {
console.error('Error saving plugin config:', error)
return NextResponse.json(
{ error: 'Failed to save plugin config' },
{ status: 500 }

View File

@@ -37,7 +37,6 @@ export async function POST(
return NextResponse.json(data)
} catch (error) {
console.error('Error disabling plugin:', error)
return NextResponse.json(
{ error: 'Failed to disable plugin' },
{ status: 500 }

View File

@@ -37,7 +37,6 @@ export async function POST(
return NextResponse.json(data)
} catch (error) {
console.error('Error enabling plugin:', error)
return NextResponse.json(
{ error: 'Failed to enable plugin' },
{ status: 500 }

View File

@@ -37,7 +37,6 @@ export async function POST(
return NextResponse.json(data)
} catch (error) {
console.error('Error loading plugin:', error)
return NextResponse.json(
{ error: 'Failed to load plugin' },
{ status: 500 }

View File

@@ -39,7 +39,6 @@ export async function DELETE(
return NextResponse.json(data)
} catch (error) {
console.error('Error uninstalling plugin:', error)
return NextResponse.json(
{ error: 'Failed to uninstall plugin' },
{ status: 500 }

View File

@@ -47,7 +47,6 @@ export async function GET(
return nextResponse
} catch (error) {
console.error('Error getting plugin schema:', error)
return NextResponse.json(
{ error: 'Failed to get plugin schema' },
{ status: 500 }

View File

@@ -39,7 +39,6 @@ export async function POST(
return NextResponse.json(data)
} catch (error) {
console.error('Error testing plugin credentials:', error)
return NextResponse.json(
{ error: 'Failed to test plugin credentials' },
{ status: 500 }

View File

@@ -37,7 +37,6 @@ export async function POST(
return NextResponse.json(data)
} catch (error) {
console.error('Error unloading plugin:', error)
return NextResponse.json(
{ error: 'Failed to unload plugin' },
{ status: 500 }

View File

@@ -46,7 +46,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error discovering plugins:', error)
return NextResponse.json(
{ error: 'Failed to discover plugins' },
{ status: 500 }

View File

@@ -35,7 +35,6 @@ export async function POST(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error installing plugin:', error)
return NextResponse.json(
{ error: 'Failed to install plugin' },
{ status: 500 }

View File

@@ -32,7 +32,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching installed plugins:', error)
return NextResponse.json(
{ error: 'Failed to fetch installed plugins' },
{ status: 500 }

View File

@@ -77,7 +77,6 @@ export async function PUT(
}
} catch (error) {
console.error(`Error updating ${params.category} settings:`, error)
return NextResponse.json(
{ error: 'Failed to update category settings' },
{ status: 500 }
@@ -122,7 +121,6 @@ export async function GET(
return NextResponse.json(data)
} catch (error) {
console.error(`Error fetching ${params.category} settings:`, error)
return NextResponse.json(
{ error: 'Failed to fetch category settings' },
{ status: 500 }

View File

@@ -42,7 +42,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching settings:', error)
return NextResponse.json(
{ error: 'Failed to fetch settings' },
{ status: 500 }
@@ -85,7 +84,6 @@ export async function PUT(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error updating settings:', error)
return NextResponse.json(
{ error: 'Failed to update settings' },
{ status: 500 }

View File

@@ -32,7 +32,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching Zammad chatbots:', error)
return NextResponse.json(
{ error: 'Failed to fetch Zammad chatbots' },
{ status: 500 }

View File

@@ -36,7 +36,6 @@ export async function PUT(request: NextRequest, { params }: { params: { id: stri
return NextResponse.json(data)
} catch (error) {
console.error('Error updating Zammad configuration:', error)
return NextResponse.json(
{ error: 'Failed to update Zammad configuration' },
{ status: 500 }
@@ -78,7 +77,6 @@ export async function DELETE(request: NextRequest, { params }: { params: { id: s
return NextResponse.json(data)
} catch (error) {
console.error('Error deleting Zammad configuration:', error)
return NextResponse.json(
{ error: 'Failed to delete Zammad configuration' },
{ status: 500 }

View File

@@ -32,7 +32,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching Zammad configurations:', error)
return NextResponse.json(
{ error: 'Failed to fetch Zammad configurations' },
{ status: 500 }
@@ -75,7 +74,6 @@ export async function POST(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error creating Zammad configuration:', error)
return NextResponse.json(
{ error: 'Failed to create Zammad configuration' },
{ status: 500 }

View File

@@ -35,7 +35,6 @@ export async function POST(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error processing Zammad tickets:', error)
return NextResponse.json(
{ error: 'Failed to process Zammad tickets' },
{ status: 500 }

View File

@@ -42,7 +42,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching Zammad processing logs:', error)
return NextResponse.json(
{ error: 'Failed to fetch Zammad processing logs' },
{ status: 500 }

View File

@@ -32,7 +32,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error fetching Zammad status:', error)
return NextResponse.json(
{ error: 'Failed to fetch Zammad status' },
{ status: 500 }

View File

@@ -35,7 +35,6 @@ export async function POST(request: NextRequest) {
return NextResponse.json(data)
} catch (error) {
console.error('Error testing Zammad connection:', error)
return NextResponse.json(
{ error: 'Failed to test Zammad connection' },
{ status: 500 }

View File

@@ -113,7 +113,6 @@ export default function AuditPage() {
setTotalPages(Math.ceil((logsData.total || 0) / pageSize));
setStats(statsData);
} catch (error) {
console.error("Failed to fetch audit data:", error);
toast({
title: "Error",
description: "Failed to fetch audit logs",
@@ -165,7 +164,6 @@ export default function AuditPage() {
description: "Audit logs have been exported successfully",
});
} catch (error) {
console.error("Failed to export audit logs:", error);
toast({
title: "Export Failed",
description: error instanceof Error ? error.message : "Failed to export audit logs",
@@ -492,7 +490,6 @@ export default function AuditPage() {
metadata: JSON.stringify(log.metadata, null, 2)
};
// Would open a detail modal in a real implementation
console.log("Audit log details:", details);
}}
>
<Eye className="mr-2 h-3 w-3" />

View File

@@ -119,7 +119,6 @@ export default function BudgetsPage() {
setStats(statsData.value);
}
} catch (error) {
console.error("Failed to fetch budget data:", error);
toast({
title: "Error",
description: "Failed to fetch budget data",
@@ -155,7 +154,6 @@ export default function BudgetsPage() {
await fetchBudgetData();
} catch (error) {
console.error("Failed to create budget:", error);
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to create budget",
@@ -180,7 +178,6 @@ export default function BudgetsPage() {
setEditingBudget(null);
await fetchBudgetData();
} catch (error) {
console.error("Failed to update budget:", error);
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to update budget",
@@ -212,7 +209,6 @@ export default function BudgetsPage() {
await fetchBudgetData();
} catch (error) {
console.error("Failed to delete budget:", error);
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to delete budget",

View File

@@ -129,7 +129,6 @@ function DashboardContent() {
setRecentActivity([])
} catch (error) {
console.error('Error fetching dashboard data:', error)
// Set empty states on error
setStats({
activeModules: 0,

View File

@@ -99,7 +99,6 @@ function LLMPageContent() {
const fetchData = async () => {
try {
console.log('Fetching data...')
setLoading(true)
const token = localStorage.getItem('token')
if (!token) {
@@ -109,11 +108,9 @@ function LLMPageContent() {
// Fetch API keys and models using API client
const [keysData, modelsData] = await Promise.all([
apiClient.get('/api-internal/v1/api-keys').catch(e => {
console.error('Failed to fetch API keys:', e)
return { data: [] }
}),
apiClient.get('/api-internal/v1/llm/models').catch(e => {
console.error('Failed to fetch models:', e)
return { data: [] }
})
])
@@ -122,7 +119,6 @@ function LLMPageContent() {
setModels(modelsData.data || [])
} catch (error) {
console.error('Error fetching data:', error)
toast({
title: "Error",
description: "Failed to load data",
@@ -169,11 +165,9 @@ function LLMPageContent() {
const deleteAPIKey = async (keyId: number) => {
try {
console.log('Deleting API key with ID:', keyId)
setLoading(true)
const responseData = await apiClient.delete(`/api-internal/v1/api-keys/${keyId}`)
console.log('Delete response data:', responseData)
toast({
title: "Success",
@@ -182,9 +176,7 @@ function LLMPageContent() {
// Force refresh data and wait for it to complete
await fetchData()
console.log('Data refreshed after deletion')
} catch (error) {
console.error('Error deleting API key:', error)
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to delete API key",

View File

@@ -120,7 +120,6 @@ export default function PromptTemplatesPage() {
setTemplates(templatesResult.value)
setVariables(variablesResult.value)
} catch (error) {
console.error('Error loading data:', error)
toast.error('Failed to load prompt templates')
} finally {
setLoading(false)
@@ -162,7 +161,6 @@ export default function PromptTemplatesPage() {
setEditingTemplate(null)
} catch (error) {
console.error('Error saving template:', error)
toast.error(error instanceof Error ? error.message : 'Failed to save template')
} finally {
setSaving(false)
@@ -178,7 +176,6 @@ export default function PromptTemplatesPage() {
await loadData()
} catch (error) {
console.error('Error resetting template:', error)
toast.error(error instanceof Error ? error.message : 'Failed to reset template')
}
}
@@ -228,7 +225,6 @@ export default function PromptTemplatesPage() {
setUseCustomType(false)
} catch (error) {
console.error('Error creating template:', error)
toast.error(error instanceof Error ? error.message : 'Failed to create template')
} finally {
setSaving(false)
@@ -261,7 +257,6 @@ export default function PromptTemplatesPage() {
toast.success('Prompt improved with AI successfully')
} catch (error) {
console.error('Error improving prompt with AI:', error)
toast.error(error instanceof Error ? error.message : 'Failed to improve prompt')
} finally {
setImprovingWithAI(false)

View File

@@ -77,7 +77,6 @@ function RAGPageContent() {
const data = await apiClient.get('/api-internal/v1/rag/collections')
setCollections(data.collections || [])
} catch (error) {
console.error('Failed to load collections:', error)
} finally {
setLoading(false)
}
@@ -88,7 +87,6 @@ function RAGPageContent() {
const data = await apiClient.get('/api-internal/v1/rag/stats')
setStats(data.stats)
} catch (error) {
console.error('Failed to load stats:', error)
}
}

View File

@@ -121,7 +121,6 @@ export default function RegisterPage() {
// Redirect to login page
router.push("/login?message=registration-success");
} catch (error) {
console.error("Registration error:", error);
toast({
title: "Registration failed",
description: error instanceof Error ? error.message : "An unexpected error occurred",

View File

@@ -198,7 +198,6 @@ function SettingsPageContent() {
setSettings(transformedSettings);
setIsDirty(false);
} catch (error) {
console.error("Failed to fetch settings:", error);
toast({
title: "Error",
description: "Failed to fetch system settings",
@@ -239,7 +238,6 @@ function SettingsPageContent() {
setIsDirty(false);
} catch (error) {
console.error("Failed to save settings:", error);
toast({
title: "Save Failed",
description: error instanceof Error ? error.message : "Failed to save settings",
@@ -259,7 +257,6 @@ function SettingsPageContent() {
description: `${type.toUpperCase()} connection is working properly`,
});
} catch (error) {
console.error(`Failed to test ${type} connection:`, error);
toast({
title: "Connection Test Failed",
description: error instanceof Error ? error.message : `Failed to test ${type} connection`,
@@ -287,7 +284,6 @@ function SettingsPageContent() {
triggerModuleRefresh();
}
} catch (error) {
console.error(`Failed to ${action} module:`, error);
toast({
title: "Error",
description: error instanceof Error ? error.message : `Failed to ${action} module`,

View File

@@ -100,7 +100,6 @@ export function ChatInterface({ chatbotId, chatbotName, onClose }: ChatInterface
} catch (error) {
const appError = error as AppError
console.error('Error sending message:', appError)
// More specific error handling
if (appError.code === 'UNAUTHORIZED') {
@@ -127,7 +126,6 @@ export function ChatInterface({ chatbotId, chatbotName, onClose }: ChatInterface
await navigator.clipboard.writeText(content)
toast.success("Copied", "Message copied to clipboard")
} catch (error) {
console.error('Failed to copy message:', error)
toast.error("Copy Failed", "Unable to copy message to clipboard")
}
}, [toast])

View File

@@ -216,7 +216,6 @@ export function ChatbotManager() {
const data = await apiClient.get('/api-internal/v1/chatbot/list')
setChatbots(data)
} catch (error) {
console.error('Failed to load chatbots:', error)
toast({
title: "Error",
description: "Failed to load chatbots",
@@ -232,7 +231,6 @@ export function ChatbotManager() {
const data = await apiClient.get('/api-internal/v1/rag/collections')
setRagCollections(data.collections || [])
} catch (error) {
console.error('Failed to load RAG collections:', error)
}
}
@@ -241,7 +239,6 @@ export function ChatbotManager() {
const templates = await apiClient.get('/api-internal/v1/prompt-templates/templates')
setPromptTemplates(templates)
} catch (error) {
console.error('Failed to load prompt templates:', error)
}
}
@@ -345,7 +342,6 @@ export function ChatbotManager() {
description: `${deletingChatbot.name} has been deleted`
})
} catch (error) {
console.error('Failed to delete chatbot:', error)
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to delete chatbot",

View File

@@ -136,7 +136,6 @@ export function ZammadConfig() {
fetchModuleStatus()
])
} catch (error) {
console.error("Error fetching Zammad data:", error)
toast({
title: "Error",
description: "Failed to load Zammad configuration",
@@ -152,7 +151,7 @@ export function ZammadConfig() {
const data = await apiClient.get("/api-internal/v1/zammad/configurations")
setConfigurations(data.configurations || [])
} catch (error) {
console.error("Error fetching configurations:", error)
// Silent failure for configuration fetching
}
}
@@ -161,7 +160,7 @@ export function ZammadConfig() {
const data = await apiClient.get("/api-internal/v1/zammad/chatbots")
setChatbots(data.chatbots || [])
} catch (error) {
console.error("Error fetching chatbots:", error)
// Silent failure for chatbot fetching
}
}
@@ -170,7 +169,7 @@ export function ZammadConfig() {
const data = await apiClient.get("/api-internal/v1/zammad/processing-logs?limit=5")
setProcessingLogs(data.logs || [])
} catch (error) {
console.error("Error fetching processing logs:", error)
// Silent failure for processing logs fetching
}
}
@@ -179,7 +178,7 @@ export function ZammadConfig() {
const data = await apiClient.get("/api-internal/v1/zammad/status")
setModuleStatus(data)
} catch (error) {
console.error("Error fetching module status:", error)
// Silent failure for module status fetching
}
}
@@ -225,7 +224,6 @@ export function ZammadConfig() {
await fetchConfigurations()
} catch (error) {
console.error("Error saving configuration:", error)
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to save configuration",
@@ -253,8 +251,6 @@ export function ZammadConfig() {
zammad_url: newConfig.zammad_url,
api_token: newConfig.api_token
})
console.log("Test connection response:", data)
if (data.status === "success") {
toast({
title: "✅ Connection Successful",
@@ -270,7 +266,6 @@ export function ZammadConfig() {
})
}
} catch (error) {
console.error("Error testing connection:", error)
toast({
title: "⚠️ Connection Test Error",
description: `Failed to test connection: ${error instanceof Error ? error.message : 'Unknown error'}`,
@@ -302,7 +297,6 @@ export function ZammadConfig() {
fetchModuleStatus()
}, 2000)
} catch (error) {
console.error("Error processing tickets:", error)
toast({
title: "Error",
description: error instanceof Error ? error.message : "Failed to process tickets",
@@ -324,7 +318,6 @@ export function ZammadConfig() {
await fetchConfigurations()
} catch (error) {
console.error("Error deleting configuration:", error)
toast({
title: "Error",
description: "Failed to delete configuration",

View File

@@ -283,7 +283,6 @@ export const PluginManager: React.FC = () => {
break;
}
} catch (err) {
console.error(`Failed to ${action} plugin:`, err);
}
};
@@ -291,7 +290,6 @@ export const PluginManager: React.FC = () => {
try {
await installPlugin(plugin.id, plugin.version);
} catch (err) {
console.error('Failed to install plugin:', err);
}
};

View File

@@ -53,7 +53,6 @@ const PluginIframe: React.FC<PluginIframeProps> = ({
].filter(Boolean);
if (!allowedOrigins.some(origin => event.origin.startsWith(origin))) {
console.warn('Rejected message from unauthorized origin:', event.origin);
return;
}
@@ -84,7 +83,6 @@ const PluginIframe: React.FC<PluginIframeProps> = ({
break;
}
} catch (err) {
console.error('Error processing plugin message:', err);
}
};

View File

@@ -62,7 +62,6 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
localStorage.setItem('token', previousToken)
}
} catch (error) {
console.error("Token validation failed:", error)
localStorage.removeItem("access_token")
localStorage.removeItem("refresh_token")
} finally {

View File

@@ -88,7 +88,6 @@ export function DocumentBrowser({ collections, selectedCollection, onCollectionS
const data = await apiClient.get(url)
setDocuments(data.documents || [])
} catch (error) {
console.error('Failed to load documents:', error)
} finally {
setLoading(false)
}

View File

@@ -57,7 +57,6 @@ export function ModulesProvider({ children }: { children: ReactNode }) {
setLastUpdated(new Date())
} catch (err) {
console.error("Error fetching modules:", err)
setError(err instanceof Error ? err.message : "Failed to load modules")
} finally {
setIsLoading(false)

View File

@@ -152,7 +152,6 @@ export const PluginProvider: React.FC<PluginProviderProps> = ({ children }) => {
}));
}
} catch (e) {
console.warn(`Failed to load config for plugin ${plugin.id}:`, e);
}
}
@@ -325,7 +324,6 @@ export const PluginProvider: React.FC<PluginProviderProps> = ({ children }) => {
const data = await apiRequest(`/${pluginId}/config`);
return data;
} catch (err) {
console.error(`Failed to get configuration for plugin ${pluginId}:`, err);
return null;
}
};
@@ -380,7 +378,6 @@ export const PluginProvider: React.FC<PluginProviderProps> = ({ children }) => {
}));
}
} catch (chatbotError) {
console.warn('Failed to load chatbots for Zammad configuration:', chatbotError);
}
// Populate model options for AI settings
@@ -405,7 +402,6 @@ export const PluginProvider: React.FC<PluginProviderProps> = ({ children }) => {
schema.properties.draft_settings.properties.model.options = modelOptions;
}
} catch (modelError) {
console.warn('Failed to load models for Zammad configuration:', modelError);
}
}
@@ -422,13 +418,11 @@ export const PluginProvider: React.FC<PluginProviderProps> = ({ children }) => {
}));
}
} catch (modelError) {
console.warn('Failed to load models for Signal configuration:', modelError);
}
}
return schema;
} catch (err) {
console.error(`Failed to get schema for plugin ${pluginId}:`, err);
return null;
}
};
@@ -460,7 +454,6 @@ export const PluginProvider: React.FC<PluginProviderProps> = ({ children }) => {
}));
} catch (err) {
console.error(`Failed to load components for plugin ${pluginId}:`, err);
}
};

View File

@@ -63,7 +63,6 @@ export function useChatbotForm() {
setChatbots(data)
} catch (error) {
const appError = error as AppError
console.error('Error loading chatbots:', appError)
toast.error("Loading Failed", "Failed to load chatbots")
} finally {
setIsLoading(false)
@@ -80,7 +79,6 @@ export function useChatbotForm() {
return newChatbot
} catch (error) {
const appError = error as AppError
console.error('Error creating chatbot:', appError)
if (appError.code === 'VALIDATION_ERROR') {
toast.error("Validation Error", appError.details || "Please check your input")
@@ -103,7 +101,6 @@ export function useChatbotForm() {
return updatedChatbot
} catch (error) {
const appError = error as AppError
console.error('Error updating chatbot:', appError)
toast.error("Update Failed", "Failed to update chatbot")
throw error
} finally {
@@ -120,7 +117,6 @@ export function useChatbotForm() {
toast.success("Success", "Chatbot deleted successfully")
} catch (error) {
const appError = error as AppError
console.error('Error deleting chatbot:', appError)
toast.error("Deletion Failed", "Failed to delete chatbot")
throw error
} finally {

View File

@@ -47,7 +47,6 @@ export function useBudgetStatus(autoRefresh = true, refreshInterval = 30000) {
} catch (err) {
const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred'
setError(errorMessage)
console.error('Budget status fetch error:', err)
} finally {
setLoading(false)
}