mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-18 21:15:16 +02:00
chore: linting
This commit is contained in:
parent
4b8a2f9726
commit
b89866541e
10 changed files with 42 additions and 59 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import { loader } from "fumadocs-core/source";
|
||||
import type { MetadataRoute } from "next";
|
||||
import { blog, changelog } from "@/.source/server";
|
||||
import { source as docsSource } from "@/lib/source";
|
||||
import { SERVER_BACKEND_URL } from "@/lib/env-config";
|
||||
import { source as docsSource } from "@/lib/source";
|
||||
|
||||
const blogSource = loader({
|
||||
baseUrl: "/blog",
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
import { Search } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import { useIsSelfHosted } from "@/components/providers/runtime-config";
|
||||
import { EnumConnectorName } from "@/contracts/enums/connector";
|
||||
import type { SearchSourceConnector } from "@/contracts/types/connector.types";
|
||||
import { usePlatform } from "@/hooks/use-platform";
|
||||
import { useIsSelfHosted } from "@/components/providers/runtime-config";
|
||||
import { ConnectorCard } from "../components/connector-card";
|
||||
import {
|
||||
COMPOSIO_CONNECTORS,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import type { FolderDisplay } from "@/components/documents/FolderNode";
|
|||
import { FolderPickerDialog } from "@/components/documents/FolderPickerDialog";
|
||||
import { FolderTreeView } from "@/components/documents/FolderTreeView";
|
||||
import { VersionHistoryDialog } from "@/components/documents/version-history";
|
||||
import { useRuntimeConfig } from "@/components/providers/runtime-config";
|
||||
import { EXPORT_FILE_EXTENSIONS } from "@/components/shared/ExportMenuItems";
|
||||
import {
|
||||
DEFAULT_EXCLUDE_PATTERNS,
|
||||
|
|
@ -72,7 +73,6 @@ import type { DocumentTypeEnum } from "@/contracts/types/document.types";
|
|||
import { useDebouncedValue } from "@/hooks/use-debounced-value";
|
||||
import { useMediaQuery } from "@/hooks/use-media-query";
|
||||
import { useElectronAPI, usePlatform } from "@/hooks/use-platform";
|
||||
import { useRuntimeConfig } from "@/components/providers/runtime-config";
|
||||
import { anonymousChatApiService } from "@/lib/apis/anonymous-chat-api.service";
|
||||
import { documentsApiService } from "@/lib/apis/documents-api.service";
|
||||
import { foldersApiService } from "@/lib/apis/folders-api.service";
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import {
|
|||
} from "@/components/ui/select";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import {
|
||||
MAX_DURATION_SECONDS,
|
||||
type LanguageOptions,
|
||||
MAX_DURATION_SECONDS,
|
||||
MAX_SPEAKERS,
|
||||
MIN_DURATION_SECONDS,
|
||||
type PodcastSpec,
|
||||
|
|
@ -68,7 +68,7 @@ interface BriefReviewProps {
|
|||
export function BriefReview({ podcast, spec }: BriefReviewProps) {
|
||||
const [draft, setDraft] = useState<PodcastSpec>(spec);
|
||||
const [durationUnit, setDurationUnit] = useState<DurationUnit>(() =>
|
||||
defaultDurationUnit(spec.duration.max_seconds),
|
||||
defaultDurationUnit(spec.duration.max_seconds)
|
||||
);
|
||||
const [voices, setVoices] = useState<VoiceOption[] | null>(null);
|
||||
const [offering, setOffering] = useState<LanguageOptions | null>(null);
|
||||
|
|
@ -361,7 +361,7 @@ export function BriefReview({ podcast, spec }: BriefReviewProps) {
|
|||
value={formatDurationForUnit(draft.duration.min_seconds, durationUnit)}
|
||||
onChange={(e) => {
|
||||
const seconds = clampDurationSeconds(
|
||||
fromUnitValue(Number(e.target.value), durationUnit),
|
||||
fromUnitValue(Number(e.target.value), durationUnit)
|
||||
);
|
||||
setDraft((current) => ({
|
||||
...current,
|
||||
|
|
@ -381,15 +381,9 @@ export function BriefReview({ podcast, spec }: BriefReviewProps) {
|
|||
value={formatDurationForUnit(draft.duration.max_seconds, durationUnit)}
|
||||
onChange={(e) => {
|
||||
const parsed = Number(e.target.value);
|
||||
const fallback = secondsToUnitValue(
|
||||
draft.duration.min_seconds,
|
||||
durationUnit,
|
||||
);
|
||||
const fallback = secondsToUnitValue(draft.duration.min_seconds, durationUnit);
|
||||
const seconds = clampDurationSeconds(
|
||||
fromUnitValue(
|
||||
Number.isFinite(parsed) ? parsed : fallback,
|
||||
durationUnit,
|
||||
),
|
||||
fromUnitValue(Number.isFinite(parsed) ? parsed : fallback, durationUnit)
|
||||
);
|
||||
setDraft((current) => ({
|
||||
...current,
|
||||
|
|
@ -426,9 +420,7 @@ export function BriefReview({ podcast, spec }: BriefReviewProps) {
|
|||
<Button
|
||||
type="button"
|
||||
onClick={handleApprove}
|
||||
disabled={
|
||||
isSubmitting || draft.duration.max_seconds < draft.duration.min_seconds
|
||||
}
|
||||
disabled={isSubmitting || draft.duration.max_seconds < draft.duration.min_seconds}
|
||||
>
|
||||
{isSubmitting ? <Loader2 className="size-4 animate-spin" /> : null}
|
||||
{isDirty ? "Approve changes & draft transcript" : "Approve & draft transcript"}
|
||||
|
|
|
|||
|
|
@ -62,12 +62,7 @@ export type SpeakerSpec = z.infer<typeof speakerSpec>;
|
|||
|
||||
export const durationTarget = z.preprocess(
|
||||
(raw) => {
|
||||
if (
|
||||
raw &&
|
||||
typeof raw === "object" &&
|
||||
"min_minutes" in raw &&
|
||||
!("min_seconds" in raw)
|
||||
) {
|
||||
if (raw && typeof raw === "object" && "min_minutes" in raw && !("min_seconds" in raw)) {
|
||||
const legacy = raw as { min_minutes: number; max_minutes: number };
|
||||
return {
|
||||
min_seconds: legacy.min_minutes * 60,
|
||||
|
|
@ -78,21 +73,13 @@ export const durationTarget = z.preprocess(
|
|||
},
|
||||
z
|
||||
.object({
|
||||
min_seconds: z
|
||||
.number()
|
||||
.int()
|
||||
.min(MIN_DURATION_SECONDS)
|
||||
.max(MAX_DURATION_SECONDS),
|
||||
max_seconds: z
|
||||
.number()
|
||||
.int()
|
||||
.min(MIN_DURATION_SECONDS)
|
||||
.max(MAX_DURATION_SECONDS),
|
||||
min_seconds: z.number().int().min(MIN_DURATION_SECONDS).max(MAX_DURATION_SECONDS),
|
||||
max_seconds: z.number().int().min(MIN_DURATION_SECONDS).max(MAX_DURATION_SECONDS),
|
||||
})
|
||||
.refine((duration) => duration.max_seconds >= duration.min_seconds, {
|
||||
message: "Max length must be at least min length",
|
||||
path: ["max_seconds"],
|
||||
}),
|
||||
})
|
||||
);
|
||||
export type DurationTarget = z.infer<typeof durationTarget>;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,10 +26,7 @@ type BackendUrlParam = string | number | boolean | null | undefined;
|
|||
* BACKEND_URL is explicitly configured, the same path resolves against that
|
||||
* absolute backend origin.
|
||||
*/
|
||||
export function buildBackendUrl(
|
||||
path: string,
|
||||
params?: Record<string, BackendUrlParam>
|
||||
): string {
|
||||
export function buildBackendUrl(path: string, params?: Record<string, BackendUrlParam>): string {
|
||||
const backendPath = path.startsWith("/") ? path : `/${path}`;
|
||||
const queryParams = new URLSearchParams();
|
||||
|
||||
|
|
|
|||
|
|
@ -91,5 +91,7 @@ export function getSupportedExtensionsSet(
|
|||
acceptedFileTypes?: Record<string, string[]>,
|
||||
etlService?: string
|
||||
): Set<string> {
|
||||
return new Set(getSupportedExtensions(acceptedFileTypes, etlService).map((ext) => ext.toLowerCase()));
|
||||
return new Set(
|
||||
getSupportedExtensions(acceptedFileTypes, etlService).map((ext) => ext.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue