chore: linting

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-02-20 22:44:56 -08:00
parent 08c75127f1
commit 634f6f24bf
50 changed files with 292 additions and 355 deletions

View file

@ -64,9 +64,7 @@ export const ConnectorConnectView: FC<ConnectorConnectViewProps> = ({
const formId = FORM_ID_MAP[connectorType];
const root = formContainerRef.current;
const mappedForm =
root && formId
? (root.querySelector(`[id="${formId}"]`) as HTMLFormElement | null)
: null;
root && formId ? (root.querySelector(`[id="${formId}"]`) as HTMLFormElement | null) : null;
// Fallback to currently rendered form to avoid silent no-op
// when a connector type or form id mapping drifts.
const fallbackForm = root?.querySelector("form") as HTMLFormElement | null;

View file

@ -1,8 +1,8 @@
"use client";
import { ExternalLink } from "lucide-react";
import type { FC } from "react";
import { useState } from "react";
import { ExternalLink } from "lucide-react";
import { SourceDetailPanel } from "@/components/new-chat/source-detail-panel";
interface InlineCitationProps {
@ -14,10 +14,7 @@ interface InlineCitationProps {
* Inline citation for knowledge-base chunks (numeric chunk IDs).
* Renders a clickable badge showing the actual chunk ID that opens the SourceDetailPanel.
*/
export const InlineCitation: FC<InlineCitationProps> = ({
chunkId,
isDocsChunk = false,
}) => {
export const InlineCitation: FC<InlineCitationProps> = ({ chunkId, isDocsChunk = false }) => {
const [isOpen, setIsOpen] = useState(false);
return (

View file

@ -36,7 +36,7 @@ function preprocessMarkdown(content: string): string {
_pendingUrlCitations = new Map();
_urlCiteIdx = 0;
content = content.replace(
/[[【]\u200B?citation:\s*(https?:\/\/[^\]\】\u200B]+)\s*\u200B?[\]】]/g,
/[[【]\u200B?citation:\s*(https?:\/\/[^\]】\u200B]+)\s*\u200B?[\]】]/g,
(_, url) => {
const key = `urlcite${_urlCiteIdx++}`;
_pendingUrlCitations.set(key, url.trim());
@ -73,7 +73,7 @@ function preprocessMarkdown(content: string): string {
// URL-based IDs from live web search, or urlciteN placeholders from preprocess.
// Also matches Chinese brackets 【】 and handles zero-width spaces that LLM sometimes inserts.
const CITATION_REGEX =
/[[【]\u200B?citation:\s*(https?:\/\/[^\]\】\u200B]+|urlcite\d+|(?:doc-)?\d+(?:\s*,\s*(?:doc-)?\d+)*)\s*\u200B?[\]】]/g;
/[[【]\u200B?citation:\s*(https?:\/\/[^\]】\u200B]+|urlcite\d+|(?:doc-)?\d+(?:\s*,\s*(?:doc-)?\d+)*)\s*\u200B?[\]】]/g;
/**
* Parses text and replaces [citation:XXX] patterns with citation components.
@ -100,16 +100,12 @@ function parseTextWithCitations(text: string): ReactNode[] {
const captured = match[1];
if (captured.startsWith("http://") || captured.startsWith("https://")) {
parts.push(
<UrlCitation key={`citation-url-${instanceIndex}`} url={captured.trim()} />
);
parts.push(<UrlCitation key={`citation-url-${instanceIndex}`} url={captured.trim()} />);
instanceIndex++;
} else if (captured.startsWith("urlcite")) {
const url = _pendingUrlCitations.get(captured);
if (url) {
parts.push(
<UrlCitation key={`citation-url-${instanceIndex}`} url={url} />
);
parts.push(<UrlCitation key={`citation-url-${instanceIndex}`} url={url} />);
}
instanceIndex++;
} else {