chore(LINT-0001) fix lint errors
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import './layout.css';
|
||||
import { resolve as resolveRoute } from '$app/paths';
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
|
||||
let { children } = $props();
|
||||
@@ -15,7 +16,7 @@
|
||||
<div class="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex h-14 items-center justify-between">
|
||||
<div class="flex items-center gap-6">
|
||||
<a href="/" class="flex items-center gap-2 font-semibold text-gray-900">
|
||||
<a href={resolveRoute('/')} class="flex items-center gap-2 font-semibold text-gray-900">
|
||||
<svg
|
||||
class="h-6 w-6 text-blue-600"
|
||||
viewBox="0 0 24 24"
|
||||
@@ -31,9 +32,15 @@
|
||||
</svg>
|
||||
<span>TrueRef</span>
|
||||
</a>
|
||||
<a href="/" class="text-sm text-gray-600 hover:text-gray-900"> Repositories </a>
|
||||
<a href="/search" class="text-sm text-gray-600 hover:text-gray-900"> Search </a>
|
||||
<a href="/settings" class="text-sm text-gray-600 hover:text-gray-900"> Settings </a>
|
||||
<a href={resolveRoute('/')} class="text-sm text-gray-600 hover:text-gray-900">
|
||||
Repositories
|
||||
</a>
|
||||
<a href={resolveRoute('/search')} class="text-sm text-gray-600 hover:text-gray-900">
|
||||
Search
|
||||
</a>
|
||||
<a href={resolveRoute('/settings')} class="text-sm text-gray-600 hover:text-gray-900">
|
||||
Settings
|
||||
</a>
|
||||
</div>
|
||||
<span class="text-xs text-gray-400">Self-hosted documentation intelligence</span>
|
||||
</div>
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import type { Repository } from '$lib/types';
|
||||
import RepositoryCard from '$lib/components/RepositoryCard.svelte';
|
||||
import AddRepositoryModal from '$lib/components/AddRepositoryModal.svelte';
|
||||
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
|
||||
import IndexingProgress from '$lib/components/IndexingProgress.svelte';
|
||||
|
||||
let { data }: { data: PageData } = $props();
|
||||
type Repository = NonNullable<PageData['repositories']>[number];
|
||||
|
||||
// Initialized empty; $effect syncs from data prop on every navigation/reload.
|
||||
let repositories = $state<Repository[]>([]);
|
||||
$effect(() => {
|
||||
repositories = data.repositories ?? [];
|
||||
});
|
||||
// Syncs from data prop on navigation while still allowing temporary local reassignment.
|
||||
let repositories: Repository[] = $derived(data.repositories ?? []);
|
||||
let showAddModal = $state(false);
|
||||
let confirmDeleteId = $state<string | null>(null);
|
||||
let activeJobIds = $state<Record<string, string>>({});
|
||||
@@ -25,7 +22,7 @@
|
||||
async function refreshRepositories() {
|
||||
try {
|
||||
const res = await fetch('/api/v1/libs');
|
||||
const fetched = await res.json();
|
||||
const fetched = (await res.json()) as { libraries?: Repository[] };
|
||||
repositories = fetched.libraries ?? [];
|
||||
} catch {
|
||||
// keep existing list on network error
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
* type (optional) — "json" (default) or "txt"
|
||||
*/
|
||||
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { getClient } from '$lib/server/db/client';
|
||||
import { dtoJsonResponse } from '$lib/server/api/dto-response';
|
||||
|
||||
@@ -141,7 +141,8 @@ export const PUT: RequestHandler = POST;
|
||||
function sanitizeProfile(profile: EmbeddingProfile): EmbeddingProfile {
|
||||
const config = profile.config as Record<string, unknown>;
|
||||
if (config && config.apiKey) {
|
||||
const { apiKey: _apiKey, ...rest } = config;
|
||||
const rest = { ...config };
|
||||
delete rest.apiKey;
|
||||
return { ...profile, config: rest };
|
||||
}
|
||||
return profile;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { resolve as resolveRoute } from '$app/paths';
|
||||
import type { PageData } from './$types';
|
||||
import type { Repository, RepositoryVersion, IndexingJob } from '$lib/types';
|
||||
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
|
||||
@@ -79,7 +81,7 @@
|
||||
const d = await res.json();
|
||||
throw new Error(d.error ?? 'Failed to delete repository');
|
||||
}
|
||||
window.location.href = '/';
|
||||
goto(resolveRoute('/'));
|
||||
} catch (e) {
|
||||
errorMessage = (e as Error).message;
|
||||
}
|
||||
@@ -101,7 +103,7 @@
|
||||
</svelte:head>
|
||||
|
||||
<div class="mb-6">
|
||||
<a href="/" class="text-sm text-blue-600 hover:underline">← Repositories</a>
|
||||
<a href={resolveRoute('/')} class="text-sm text-blue-600 hover:underline">← Repositories</a>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
||||
@@ -124,7 +126,7 @@
|
||||
<a
|
||||
href={repo.sourceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
rel="external noopener noreferrer"
|
||||
class="mt-1 block text-sm text-blue-600 hover:underline"
|
||||
>
|
||||
{repo.sourceUrl}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { resolve as resolveRoute } from '$app/paths';
|
||||
import { page } from '$app/state';
|
||||
import { untrack } from 'svelte';
|
||||
import LibraryResult from '$lib/components/search/LibraryResult.svelte';
|
||||
@@ -106,7 +107,9 @@
|
||||
|
||||
if (syncUrl) {
|
||||
goto(
|
||||
`/search?lib=${encodeURIComponent(selectedLibraryId)}&q=${encodeURIComponent(query)}`,
|
||||
resolveRoute(
|
||||
`/search?lib=${encodeURIComponent(selectedLibraryId)}&q=${encodeURIComponent(query)}`
|
||||
),
|
||||
{ replaceState: true, keepFocus: true }
|
||||
);
|
||||
}
|
||||
@@ -133,7 +136,7 @@
|
||||
snippetError = null;
|
||||
query = '';
|
||||
// Reset URL.
|
||||
goto('/search', { replaceState: true, keepFocus: true });
|
||||
goto(resolveRoute('/search'), { replaceState: true, keepFocus: true });
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
<form class="space-y-4" onsubmit={handleSubmit}>
|
||||
<!-- Provider selector -->
|
||||
<div class="mb-4 flex gap-2">
|
||||
{#each ['none', 'openai', 'local'] as p}
|
||||
{#each ['none', 'openai', 'local'] as p (p)}
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
@@ -224,7 +224,7 @@
|
||||
<div class="space-y-3">
|
||||
<!-- Preset buttons -->
|
||||
<div class="flex flex-wrap gap-2">
|
||||
{#each PROVIDER_PRESETS as preset}
|
||||
{#each PROVIDER_PRESETS as preset (preset.name)}
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => applyPreset(preset)}
|
||||
|
||||
Reference in New Issue
Block a user