mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
Merge remote-tracking branch 'upstream/dev' into impr/thinking-steps
This commit is contained in:
commit
323f7f2b4a
7 changed files with 41 additions and 51 deletions
|
|
@ -34,7 +34,8 @@ https://github.com/user-attachments/assets/cc0c84d3-1f2f-4f7a-b519-2ecce22310b1
|
|||
## Video Agent Sample
|
||||
|
||||
|
||||
https://github.com/user-attachments/assets/cc977e6d-8292-4ffe-abb8-3b0560ef5562
|
||||
|
||||
https://github.com/user-attachments/assets/012a7ffa-6f76-4f06-9dda-7632b470057a
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ import { z } from "zod";
|
|||
import type { MCPServerConfig, MCPToolDefinition } from "@/contracts/types/mcp.types";
|
||||
import { connectorsApiService } from "@/lib/apis/connectors-api.service";
|
||||
|
||||
const IS_DEV = process.env.NODE_ENV === "development";
|
||||
|
||||
/**
|
||||
* Zod schema for MCP server configuration
|
||||
* Supports both stdio (local process) and HTTP (remote server) transports
|
||||
|
|
@ -102,11 +104,11 @@ export const parseMCPConfig = (configJson: string): MCPConfigValidationResult =>
|
|||
// Check cache first
|
||||
const cached = configCache.get(configJson);
|
||||
if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
|
||||
console.log("[MCP Validator] ✅ Using cached config");
|
||||
if (IS_DEV) console.log("[MCP Validator] ✅ Using cached config");
|
||||
return { config: cached.config, error: null };
|
||||
}
|
||||
|
||||
console.log("[MCP Validator] 🔍 Parsing new config...");
|
||||
if (IS_DEV) console.log("[MCP Validator] 🔍 Parsing new config...");
|
||||
|
||||
// Clean up expired cache entries periodically
|
||||
if (configCache.size > 100) {
|
||||
|
|
@ -176,7 +178,7 @@ export const parseMCPConfig = (configJson: string): MCPConfigValidationResult =>
|
|||
timestamp: Date.now(),
|
||||
});
|
||||
|
||||
console.log("[MCP Validator] ✅ Config parsed successfully:", config);
|
||||
if (IS_DEV) console.log("[MCP Validator] ✅ Config parsed successfully:", config);
|
||||
|
||||
return {
|
||||
config,
|
||||
|
|
|
|||
|
|
@ -272,19 +272,17 @@ function NavbarGitHubStars({
|
|||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={cn(
|
||||
"group flex items-center gap-1.5 rounded-lg px-1 py-1 hover:bg-gray-100 dark:hover:bg-neutral-800/50 transition-colors",
|
||||
"group flex items-center gap-1 rounded-lg px-2 py-1 hover:bg-gray-100 dark:hover:bg-neutral-800/50 transition-colors",
|
||||
className
|
||||
)}
|
||||
>
|
||||
<IconBrandGithub className="h-5 w-5 text-neutral-600 dark:text-neutral-300 shrink-0" />
|
||||
<span className="rounded-lg bg-[#282828] px-2 py-0 group-hover:bg-neutral-800/80 transition-colors inline-flex items-center">
|
||||
<AnimatedStarCount
|
||||
value={isLoading ? 10000 : stars}
|
||||
itemSize={ITEM_SIZE}
|
||||
isRolling={isLoading}
|
||||
className="text-sm font-semibold tabular-nums text-neutral-500 group-hover:text-neutral-400 transition-colors"
|
||||
/>
|
||||
</span>
|
||||
<IconBrandGithub className="h-5 w-5 text-neutral-700 dark:text-neutral-300 shrink-0" />
|
||||
<AnimatedStarCount
|
||||
value={isLoading ? 10000 : stars}
|
||||
itemSize={ITEM_SIZE}
|
||||
isRolling={isLoading}
|
||||
className="text-sm font-semibold tabular-nums text-neutral-700 dark:text-neutral-300 group-hover:text-neutral-900 dark:group-hover:text-neutral-100 transition-colors"
|
||||
/>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import {
|
|||
} from "@/lib/electric/client";
|
||||
import { ElectricContext } from "@/lib/electric/context";
|
||||
|
||||
const IS_DEV = process.env.NODE_ENV === "development";
|
||||
|
||||
interface ElectricProviderProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
|
@ -40,7 +42,7 @@ export function ElectricProvider({ children }: ElectricProviderProps) {
|
|||
// No user logged in - cleanup if previous user existed
|
||||
if (!isUserLoaded || !user?.id) {
|
||||
if (previousUserIdRef.current && isElectricInitialized()) {
|
||||
console.log("[ElectricProvider] User logged out, cleaning up...");
|
||||
if (IS_DEV) console.log("[ElectricProvider] User logged out, cleaning up...");
|
||||
cleanupElectric().then(() => {
|
||||
previousUserIdRef.current = null;
|
||||
setElectricClient(null);
|
||||
|
|
@ -61,14 +63,14 @@ export function ElectricProvider({ children }: ElectricProviderProps) {
|
|||
|
||||
async function init() {
|
||||
try {
|
||||
console.log(`[ElectricProvider] Initializing for user: ${userId}`);
|
||||
if (IS_DEV) console.log(`[ElectricProvider] Initializing for user: ${userId}`);
|
||||
const client = await initElectric(userId);
|
||||
|
||||
if (mounted) {
|
||||
previousUserIdRef.current = userId;
|
||||
setElectricClient(client);
|
||||
setError(null);
|
||||
console.log(`[ElectricProvider] ✅ Ready for user: ${userId}`);
|
||||
if (IS_DEV) console.log(`[ElectricProvider] ✅ Ready for user: ${userId}`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("[ElectricProvider] Failed to initialize:", err);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import {
|
||||
DownloadIcon,
|
||||
EllipsisVerticalIcon,
|
||||
PauseIcon,
|
||||
PlayIcon,
|
||||
Volume2Icon,
|
||||
|
|
@ -10,12 +9,6 @@ import {
|
|||
} from "lucide-react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { Slider } from "@/components/ui/slider";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
|
|
@ -189,23 +182,15 @@ export function Audio({ id, src, title, durationMs, className }: AudioProps) {
|
|||
|
||||
<div className="flex items-start gap-2 px-5 pt-5 pb-4">
|
||||
<p className="text-sm font-semibold text-foreground line-clamp-2 flex-1 min-w-0">{title}</p>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="size-7 shrink-0 -mt-0.5 -mr-2 text-muted-foreground"
|
||||
>
|
||||
<EllipsisVerticalIcon className="size-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem onClick={handleDownload}>
|
||||
<DownloadIcon className="size-4" />
|
||||
Download
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={handleDownload}
|
||||
className="size-7 shrink-0 -mt-0.5 -mr-2 text-muted-foreground"
|
||||
aria-label="Download audio"
|
||||
>
|
||||
<DownloadIcon className="size-4" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="mx-5 h-px bg-border/50" />
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import type { SearchSourceConnector } from "@/contracts/types/connector.types";
|
|||
import type { SyncHandle } from "@/lib/electric/client";
|
||||
import { useElectricClient } from "@/lib/electric/context";
|
||||
|
||||
const IS_DEV = process.env.NODE_ENV === "development";
|
||||
|
||||
/**
|
||||
* Hook for managing connectors with Electric SQL real-time sync
|
||||
*
|
||||
|
|
@ -72,7 +74,7 @@ export function useConnectorsElectric(searchSpaceId: number | string | null) {
|
|||
|
||||
async function startSync() {
|
||||
try {
|
||||
console.log("[useConnectorsElectric] Starting sync for search space:", searchSpaceId);
|
||||
if (IS_DEV) console.log("[useConnectorsElectric] Starting sync for search space:", searchSpaceId);
|
||||
|
||||
const handle = await electricClient.syncShape({
|
||||
table: "search_source_connectors",
|
||||
|
|
@ -80,7 +82,7 @@ export function useConnectorsElectric(searchSpaceId: number | string | null) {
|
|||
primaryKey: ["id"],
|
||||
});
|
||||
|
||||
console.log("[useConnectorsElectric] Sync started:", {
|
||||
if (IS_DEV) console.log("[useConnectorsElectric] Sync started:", {
|
||||
isUpToDate: handle.isUpToDate,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ export function useMessagesElectric(
|
|||
handle.initialSyncPromise,
|
||||
new Promise((resolve) => setTimeout(resolve, 3000)),
|
||||
]);
|
||||
} catch {
|
||||
// Timeout
|
||||
} catch (err) {
|
||||
console.warn("[useMessagesElectric] Sync timeout:", err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,8 +70,8 @@ export function useMessagesElectric(
|
|||
syncHandleRef.current = handle;
|
||||
await fetchMessages();
|
||||
await setupLiveQuery();
|
||||
} catch {
|
||||
// Sync failed
|
||||
} catch (err) {
|
||||
console.warn("[useMessagesElectric] Sync failed:", err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -88,8 +88,8 @@ export function useMessagesElectric(
|
|||
if (mounted && result.rows) {
|
||||
handleMessagesUpdate(result.rows);
|
||||
}
|
||||
} catch {
|
||||
// Query failed
|
||||
} catch (err) {
|
||||
console.warn("[useMessagesElectric] Query failed:", err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -130,8 +130,8 @@ export function useMessagesElectric(
|
|||
liveQueryRef.current = liveQuery;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Live query failed
|
||||
} catch (err) {
|
||||
console.warn("[useMessagesElectric] Live query failed:", err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue