Вроде работает

This commit is contained in:
2026-01-30 11:10:16 +03:00
parent 8044f85ea4
commit 252a8601a9
43 changed files with 1987 additions and 270 deletions

View File

@@ -0,0 +1,48 @@
<!-- [DEF:LLMSettingsPage:Component] -->
<!--
@TIER: STANDARD
@PURPOSE: Admin settings page for LLM provider configuration.
@LAYER: UI
@RELATION: CALLS -> frontend/src/components/llm/ProviderConfig.svelte
-->
<script>
import { onMount } from 'svelte';
import ProviderConfig from '../../../../components/llm/ProviderConfig.svelte';
import { requestApi } from '../../../../lib/api';
let providers = [];
let loading = true;
async function fetchProviders() {
loading = true;
try {
providers = await requestApi('/llm/providers');
} catch (err) {
console.error("Failed to fetch providers", err);
} finally {
loading = false;
}
}
onMount(fetchProviders);
</script>
<div class="max-w-4xl mx-auto py-8 px-4">
<div class="mb-8">
<h1 class="text-3xl font-bold text-gray-900">LLM Settings</h1>
<p class="mt-2 text-gray-600">
Configure LLM providers for dashboard validation, documentation generation, and git assistance.
</p>
</div>
{#if loading}
<div class="flex justify-center py-12">
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"></div>
</div>
{:else}
<ProviderConfig {providers} onSave={fetchProviders} />
{/if}
</div>
<!-- [/DEF:LLMSettingsPage:Component] -->

View File

@@ -13,6 +13,7 @@
<script lang="ts">
import { onMount } from 'svelte';
import { auth } from '../../lib/auth/store';
import { api } from '../../lib/api';
import { goto } from '$app/navigation';
let username = '';
@@ -53,18 +54,12 @@
auth.setToken(data.access_token);
// Fetch user profile
const profileRes = await fetch('/api/auth/me', {
headers: {
'Authorization': `Bearer ${data.access_token}`
}
});
if (profileRes.ok) {
const user = await profileRes.json();
try {
const user = await api.fetchApi('/auth/me');
auth.setUser(user);
goto('/');
} else {
error = 'Failed to fetch user profile';
} catch (err) {
error = 'Failed to fetch user profile: ' + err.message;
}
} else {
const errData = await response.json();

View File

@@ -311,6 +311,7 @@
<DashboardGrid
{dashboards}
bind:selectedIds={selectedDashboardIds}
environmentId={sourceEnvId}
/>
{:else}
<p class="text-gray-500 italic">Select a source environment to view dashboards.</p>