chore: linting

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-04-22 01:05:31 -07:00
parent c85c3a438e
commit 80d3f624d4
9 changed files with 310 additions and 127 deletions

View file

@ -46,7 +46,7 @@ if TYPE_CHECKING:
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def _sanitize_message_content(msg: "AnyMessage") -> "AnyMessage": def _sanitize_message_content(msg: AnyMessage) -> AnyMessage:
"""Return ``msg`` with ``content`` coerced to a non-``None`` value. """Return ``msg`` with ``content`` coerced to a non-``None`` value.
``get_buffer_string`` reads ``m.text`` which iterates ``self.content``; ``get_buffer_string`` reads ``m.text`` which iterates ``self.content``;
@ -90,16 +90,14 @@ class SafeSummarizationMiddleware(SummarizationMiddleware):
implementations from upstream. implementations from upstream.
""" """
def _filter_summary_messages( def _filter_summary_messages(self, messages: list[AnyMessage]) -> list[AnyMessage]:
self, messages: "list[AnyMessage]"
) -> "list[AnyMessage]":
filtered = super()._filter_summary_messages(messages) filtered = super()._filter_summary_messages(messages)
return [_sanitize_message_content(m) for m in filtered] return [_sanitize_message_content(m) for m in filtered]
def create_safe_summarization_middleware( def create_safe_summarization_middleware(
model: "BaseChatModel", model: BaseChatModel,
backend: "BACKEND_TYPES", backend: BACKEND_TYPES,
) -> SafeSummarizationMiddleware: ) -> SafeSummarizationMiddleware:
"""Drop-in replacement for ``create_summarization_middleware``. """Drop-in replacement for ``create_summarization_middleware``.

View file

@ -202,9 +202,7 @@ class TestHTTPExceptionHandler:
# Intentional 503s (e.g. feature flag off) must surface the developer # Intentional 503s (e.g. feature flag off) must surface the developer
# message so the frontend can render actionable copy. # message so the frontend can render actionable copy.
body = _assert_envelope(client.get("/http-503"), 503) body = _assert_envelope(client.get("/http-503"), 503)
assert ( assert body["error"]["message"] == "Page purchases are temporarily unavailable."
body["error"]["message"] == "Page purchases are temporarily unavailable."
)
assert body["error"]["message"] != GENERIC_5XX_MESSAGE assert body["error"]["message"] != GENERIC_5XX_MESSAGE
def test_502_preserves_detail(self, client): def test_502_preserves_detail(self, client):

View file

@ -200,8 +200,8 @@ export function DesktopContent() {
Launch on Startup Launch on Startup
</CardTitle> </CardTitle>
<CardDescription className="text-xs md:text-sm"> <CardDescription className="text-xs md:text-sm">
Automatically start SurfSense when you sign in to your computer so global Automatically start SurfSense when you sign in to your computer so global shortcuts and
shortcuts and folder sync are always available. folder sync are always available.
</CardDescription> </CardDescription>
</CardHeader> </CardHeader>
<CardContent className="px-3 md:px-6 pb-3 md:pb-6 space-y-3"> <CardContent className="px-3 md:px-6 pb-3 md:pb-6 space-y-3">
@ -232,8 +232,7 @@ export function DesktopContent() {
Start minimized to tray Start minimized to tray
</Label> </Label>
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">
Skip the main window on boot SurfSense lives in the system tray until you need Skip the main window on boot SurfSense lives in the system tray until you need it.
it.
</p> </p>
</div> </div>
<Switch <Switch

View file

@ -126,9 +126,7 @@ export function PurchaseHistoryContent() {
return [ return [
...pagePurchases.map(normalizePagePurchase), ...pagePurchases.map(normalizePagePurchase),
...tokenPurchases.map(normalizeTokenPurchase), ...tokenPurchases.map(normalizeTokenPurchase),
].sort( ].sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
(a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
);
}, [pagesQuery.data, tokensQuery.data]); }, [pagesQuery.data, tokensQuery.data]);
if (isLoading) { if (isLoading) {

View file

@ -349,12 +349,7 @@ export const AUTO_INDEX_CONNECTOR_TYPES = new Set<string>(Object.keys(AUTO_INDEX
// `lib/posthog/events.ts` or per-connector tracking code. // `lib/posthog/events.ts` or per-connector tracking code.
// ============================================================================ // ============================================================================
export type ConnectorTelemetryGroup = export type ConnectorTelemetryGroup = "oauth" | "composio" | "crawler" | "other" | "unknown";
| "oauth"
| "composio"
| "crawler"
| "other"
| "unknown";
export interface ConnectorTelemetryMeta { export interface ConnectorTelemetryMeta {
connector_type: string; connector_type: string;
@ -363,8 +358,7 @@ export interface ConnectorTelemetryMeta {
is_oauth: boolean; is_oauth: boolean;
} }
const CONNECTOR_TELEMETRY_REGISTRY: ReadonlyMap<string, ConnectorTelemetryMeta> = const CONNECTOR_TELEMETRY_REGISTRY: ReadonlyMap<string, ConnectorTelemetryMeta> = (() => {
(() => {
const map = new Map<string, ConnectorTelemetryMeta>(); const map = new Map<string, ConnectorTelemetryMeta>();
for (const c of OAUTH_CONNECTORS) { for (const c of OAUTH_CONNECTORS) {

View file

@ -360,11 +360,7 @@ export const useConnectorDialog = () => {
// Set connecting state immediately to disable button and show spinner // Set connecting state immediately to disable button and show spinner
setConnectingId(connector.id); setConnectingId(connector.id);
trackConnectorSetupStarted( trackConnectorSetupStarted(Number(searchSpaceId), connector.connectorType, "oauth_click");
Number(searchSpaceId),
connector.connectorType,
"oauth_click"
);
try { try {
// Check if authEndpoint already has query parameters // Check if authEndpoint already has query parameters
@ -487,11 +483,7 @@ export const useConnectorDialog = () => {
(connectorType: string) => { (connectorType: string) => {
if (!searchSpaceId) return; if (!searchSpaceId) return;
trackConnectorSetupStarted( trackConnectorSetupStarted(Number(searchSpaceId), connectorType, "non_oauth_click");
Number(searchSpaceId),
connectorType,
"non_oauth_click"
);
// Handle Obsidian specifically on Desktop & Cloud // Handle Obsidian specifically on Desktop & Cloud
if (connectorType === EnumConnectorName.OBSIDIAN_CONNECTOR && !selfHosted && isDesktop) { if (connectorType === EnumConnectorName.OBSIDIAN_CONNECTOR && !selfHosted && isDesktop) {

View file

@ -210,8 +210,7 @@ export function FreeChatPage() {
trackAnonymousChatMessageSent({ trackAnonymousChatMessageSent({
modelSlug, modelSlug,
messageLength: userQuery.trim().length, messageLength: userQuery.trim().length,
hasUploadedDoc: hasUploadedDoc: anonMode.isAnonymous && anonMode.uploadedDoc !== null ? true : false,
anonMode.isAnonymous && anonMode.uploadedDoc !== null ? true : false,
surface: "free_chat_page", surface: "free_chat_page",
}); });

View file

@ -426,15 +426,50 @@ const AiSortIllustration = () => (
<title>AI File Sorting illustration showing automatic folder organization</title> <title>AI File Sorting illustration showing automatic folder organization</title>
{/* Scattered documents on the left */} {/* Scattered documents on the left */}
<g opacity="0.5"> <g opacity="0.5">
<rect x="20" y="40" width="35" height="45" rx="4" className="fill-neutral-200 dark:fill-neutral-700" transform="rotate(-8 37 62)" /> <rect
<rect x="50" y="80" width="35" height="45" rx="4" className="fill-neutral-200 dark:fill-neutral-700" transform="rotate(5 67 102)" /> x="20"
<rect x="15" y="110" width="35" height="45" rx="4" className="fill-neutral-200 dark:fill-neutral-700" transform="rotate(-3 32 132)" /> y="40"
width="35"
height="45"
rx="4"
className="fill-neutral-200 dark:fill-neutral-700"
transform="rotate(-8 37 62)"
/>
<rect
x="50"
y="80"
width="35"
height="45"
rx="4"
className="fill-neutral-200 dark:fill-neutral-700"
transform="rotate(5 67 102)"
/>
<rect
x="15"
y="110"
width="35"
height="45"
rx="4"
className="fill-neutral-200 dark:fill-neutral-700"
transform="rotate(-3 32 132)"
/>
</g> </g>
{/* AI sparkle / magic in the center */} {/* AI sparkle / magic in the center */}
<g transform="translate(140, 90)"> <g transform="translate(140, 90)">
<path d="M 0,-18 L 4,-6 L 16,-4 L 6,4 L 8,16 L 0,10 L -8,16 L -6,4 L -16,-4 L -4,-6 Z" className="fill-emerald-500 dark:fill-emerald-400" opacity="0.85"> <path
<animateTransform attributeName="transform" type="rotate" from="0" to="360" dur="10s" repeatCount="indefinite" /> d="M 0,-18 L 4,-6 L 16,-4 L 6,4 L 8,16 L 0,10 L -8,16 L -6,4 L -16,-4 L -4,-6 Z"
className="fill-emerald-500 dark:fill-emerald-400"
opacity="0.85"
>
<animateTransform
attributeName="transform"
type="rotate"
from="0"
to="360"
dur="10s"
repeatCount="indefinite"
/>
</path> </path>
<circle cx="0" cy="0" r="3" className="fill-white dark:fill-emerald-200"> <circle cx="0" cy="0" r="3" className="fill-white dark:fill-emerald-200">
<animate attributeName="opacity" values="0.5;1;0.5" dur="2s" repeatCount="indefinite" /> <animate attributeName="opacity" values="0.5;1;0.5" dur="2s" repeatCount="indefinite" />
@ -442,51 +477,208 @@ const AiSortIllustration = () => (
</g> </g>
{/* Animated sorting arrows */} {/* Animated sorting arrows */}
<g className="stroke-emerald-500 dark:stroke-emerald-400" strokeWidth="2" fill="none" opacity="0.6"> <g
className="stroke-emerald-500 dark:stroke-emerald-400"
strokeWidth="2"
fill="none"
opacity="0.6"
>
<path d="M 100 70 Q 140 60, 180 50" strokeDasharray="4,4"> <path d="M 100 70 Q 140 60, 180 50" strokeDasharray="4,4">
<animate attributeName="stroke-dashoffset" from="8" to="0" dur="1s" repeatCount="indefinite" /> <animate
attributeName="stroke-dashoffset"
from="8"
to="0"
dur="1s"
repeatCount="indefinite"
/>
</path> </path>
<path d="M 100 100 Q 140 100, 180 100" strokeDasharray="4,4"> <path d="M 100 100 Q 140 100, 180 100" strokeDasharray="4,4">
<animate attributeName="stroke-dashoffset" from="8" to="0" dur="1s" repeatCount="indefinite" /> <animate
attributeName="stroke-dashoffset"
from="8"
to="0"
dur="1s"
repeatCount="indefinite"
/>
</path> </path>
<path d="M 100 130 Q 140 140, 180 150" strokeDasharray="4,4"> <path d="M 100 130 Q 140 140, 180 150" strokeDasharray="4,4">
<animate attributeName="stroke-dashoffset" from="8" to="0" dur="1s" repeatCount="indefinite" /> <animate
attributeName="stroke-dashoffset"
from="8"
to="0"
dur="1s"
repeatCount="indefinite"
/>
</path> </path>
</g> </g>
{/* Organized folder tree on the right */} {/* Organized folder tree on the right */}
{/* Root folder */} {/* Root folder */}
<g> <g>
<rect x="220" y="30" width="160" height="28" rx="6" className="fill-white dark:fill-neutral-800" opacity="0.9" /> <rect
<rect x="228" y="36" width="16" height="14" rx="3" className="fill-emerald-500 dark:fill-emerald-400" /> x="220"
<line x1="252" y1="43" x2="330" y2="43" className="stroke-neutral-400 dark:stroke-neutral-500" strokeWidth="2.5" strokeLinecap="round" /> y="30"
width="160"
height="28"
rx="6"
className="fill-white dark:fill-neutral-800"
opacity="0.9"
/>
<rect
x="228"
y="36"
width="16"
height="14"
rx="3"
className="fill-emerald-500 dark:fill-emerald-400"
/>
<line
x1="252"
y1="43"
x2="330"
y2="43"
className="stroke-neutral-400 dark:stroke-neutral-500"
strokeWidth="2.5"
strokeLinecap="round"
/>
</g> </g>
{/* Subfolder 1 */} {/* Subfolder 1 */}
<g> <g>
<line x1="240" y1="58" x2="240" y2="76" className="stroke-neutral-300 dark:stroke-neutral-600" strokeWidth="1.5" /> <line
<line x1="240" y1="76" x2="250" y2="76" className="stroke-neutral-300 dark:stroke-neutral-600" strokeWidth="1.5" /> x1="240"
<rect x="250" y="64" width="130" height="24" rx="5" className="fill-white dark:fill-neutral-800" opacity="0.85" /> y1="58"
<rect x="257" y="70" width="12" height="11" rx="2" className="fill-teal-400 dark:fill-teal-500" /> x2="240"
<line x1="276" y1="76" x2="340" y2="76" className="stroke-neutral-400 dark:stroke-neutral-500" strokeWidth="2" strokeLinecap="round" /> y2="76"
className="stroke-neutral-300 dark:stroke-neutral-600"
strokeWidth="1.5"
/>
<line
x1="240"
y1="76"
x2="250"
y2="76"
className="stroke-neutral-300 dark:stroke-neutral-600"
strokeWidth="1.5"
/>
<rect
x="250"
y="64"
width="130"
height="24"
rx="5"
className="fill-white dark:fill-neutral-800"
opacity="0.85"
/>
<rect
x="257"
y="70"
width="12"
height="11"
rx="2"
className="fill-teal-400 dark:fill-teal-500"
/>
<line
x1="276"
y1="76"
x2="340"
y2="76"
className="stroke-neutral-400 dark:stroke-neutral-500"
strokeWidth="2"
strokeLinecap="round"
/>
</g> </g>
{/* Subfolder 2 */} {/* Subfolder 2 */}
<g> <g>
<line x1="240" y1="76" x2="240" y2="108" className="stroke-neutral-300 dark:stroke-neutral-600" strokeWidth="1.5" /> <line
<line x1="240" y1="108" x2="250" y2="108" className="stroke-neutral-300 dark:stroke-neutral-600" strokeWidth="1.5" /> x1="240"
<rect x="250" y="96" width="130" height="24" rx="5" className="fill-white dark:fill-neutral-800" opacity="0.85" /> y1="76"
<rect x="257" y="102" width="12" height="11" rx="2" className="fill-cyan-400 dark:fill-cyan-500" /> x2="240"
<line x1="276" y1="108" x2="350" y2="108" className="stroke-neutral-400 dark:stroke-neutral-500" strokeWidth="2" strokeLinecap="round" /> y2="108"
className="stroke-neutral-300 dark:stroke-neutral-600"
strokeWidth="1.5"
/>
<line
x1="240"
y1="108"
x2="250"
y2="108"
className="stroke-neutral-300 dark:stroke-neutral-600"
strokeWidth="1.5"
/>
<rect
x="250"
y="96"
width="130"
height="24"
rx="5"
className="fill-white dark:fill-neutral-800"
opacity="0.85"
/>
<rect
x="257"
y="102"
width="12"
height="11"
rx="2"
className="fill-cyan-400 dark:fill-cyan-500"
/>
<line
x1="276"
y1="108"
x2="350"
y2="108"
className="stroke-neutral-400 dark:stroke-neutral-500"
strokeWidth="2"
strokeLinecap="round"
/>
</g> </g>
{/* Subfolder 3 */} {/* Subfolder 3 */}
<g> <g>
<line x1="240" y1="108" x2="240" y2="140" className="stroke-neutral-300 dark:stroke-neutral-600" strokeWidth="1.5" /> <line
<line x1="240" y1="140" x2="250" y2="140" className="stroke-neutral-300 dark:stroke-neutral-600" strokeWidth="1.5" /> x1="240"
<rect x="250" y="128" width="130" height="24" rx="5" className="fill-white dark:fill-neutral-800" opacity="0.85" /> y1="108"
<rect x="257" y="134" width="12" height="11" rx="2" className="fill-emerald-400 dark:fill-emerald-500" /> x2="240"
<line x1="276" y1="140" x2="325" y2="140" className="stroke-neutral-400 dark:stroke-neutral-500" strokeWidth="2" strokeLinecap="round" /> y2="140"
className="stroke-neutral-300 dark:stroke-neutral-600"
strokeWidth="1.5"
/>
<line
x1="240"
y1="140"
x2="250"
y2="140"
className="stroke-neutral-300 dark:stroke-neutral-600"
strokeWidth="1.5"
/>
<rect
x="250"
y="128"
width="130"
height="24"
rx="5"
className="fill-white dark:fill-neutral-800"
opacity="0.85"
/>
<rect
x="257"
y="134"
width="12"
height="11"
rx="2"
className="fill-emerald-400 dark:fill-emerald-500"
/>
<line
x1="276"
y1="140"
x2="325"
y2="140"
className="stroke-neutral-400 dark:stroke-neutral-500"
strokeWidth="2"
strokeLinecap="round"
/>
</g> </g>
{/* Sparkle accents */} {/* Sparkle accents */}
@ -495,10 +687,22 @@ const AiSortIllustration = () => (
<animate attributeName="opacity" values="0;1;0" dur="2s" repeatCount="indefinite" /> <animate attributeName="opacity" values="0;1;0" dur="2s" repeatCount="indefinite" />
</circle> </circle>
<circle cx="190" cy="155" r="1.5" className="fill-teal-400"> <circle cx="190" cy="155" r="1.5" className="fill-teal-400">
<animate attributeName="opacity" values="0;1;0" dur="2.5s" begin="0.8s" repeatCount="indefinite" /> <animate
attributeName="opacity"
values="0;1;0"
dur="2.5s"
begin="0.8s"
repeatCount="indefinite"
/>
</circle> </circle>
<circle cx="155" cy="120" r="1.5" className="fill-cyan-400"> <circle cx="155" cy="120" r="1.5" className="fill-cyan-400">
<animate attributeName="opacity" values="0;1;0" dur="3s" begin="0.4s" repeatCount="indefinite" /> <animate
attributeName="opacity"
values="0;1;0"
dur="3s"
begin="0.4s"
repeatCount="indefinite"
/>
</circle> </circle>
</g> </g>
</svg> </svg>

View file

@ -546,6 +546,7 @@ export function DocumentUploadTab({
</button> </button>
) )
) : ( ) : (
// biome-ignore lint/a11y/useSemanticElements: cannot use <button> here because the contents include nested interactive elements (renderBrowseButton renders a Button), which would be invalid HTML.
<div <div
role="button" role="button"
tabIndex={0} tabIndex={0}