mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-02 19:55:18 +02:00
chore: linting
This commit is contained in:
parent
050581ba6a
commit
a3a5b13f48
17 changed files with 104 additions and 69 deletions
|
|
@ -66,12 +66,12 @@ class NotionHistoryConnector:
|
||||||
while has_more:
|
while has_more:
|
||||||
if cursor:
|
if cursor:
|
||||||
search_params["start_cursor"] = cursor
|
search_params["start_cursor"] = cursor
|
||||||
|
|
||||||
search_results = await self.notion.search(**search_params)
|
search_results = await self.notion.search(**search_params)
|
||||||
|
|
||||||
pages.extend(search_results["results"])
|
pages.extend(search_results["results"])
|
||||||
has_more = search_results.get("has_more", False)
|
has_more = search_results.get("has_more", False)
|
||||||
|
|
||||||
if has_more:
|
if has_more:
|
||||||
cursor = search_results.get("next_cursor")
|
cursor = search_results.get("next_cursor")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -389,10 +389,12 @@ async def index_airtable_records(
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Successfully indexed new Airtable record {summary_content}"
|
f"Successfully indexed new Airtable record {summary_content}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} Airtable records processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} Airtable records processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -414,7 +416,9 @@ async def index_airtable_records(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Final commit for any remaining documents not yet committed in batches
|
# Final commit for any remaining documents not yet committed in batches
|
||||||
logger.info(f"Final commit: Total {documents_indexed} Airtable records processed")
|
logger.info(
|
||||||
|
f"Final commit: Total {documents_indexed} Airtable records processed"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
logger.info(
|
logger.info(
|
||||||
"Successfully committed all Airtable document changes to database"
|
"Successfully committed all Airtable document changes to database"
|
||||||
|
|
|
||||||
|
|
@ -353,10 +353,12 @@ async def index_clickup_tasks(
|
||||||
session.add(document)
|
session.add(document)
|
||||||
documents_indexed += 1
|
documents_indexed += 1
|
||||||
logger.info(f"Successfully indexed new task {task_name}")
|
logger.info(f"Successfully indexed new task {task_name}")
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} ClickUp tasks processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} ClickUp tasks processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -367,10 +367,12 @@ async def index_confluence_pages(
|
||||||
session.add(document)
|
session.add(document)
|
||||||
documents_indexed += 1
|
documents_indexed += 1
|
||||||
logger.info(f"Successfully indexed new page {page_title}")
|
logger.info(f"Successfully indexed new page {page_title}")
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} Confluence pages processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} Confluence pages processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -390,7 +392,9 @@ async def index_confluence_pages(
|
||||||
await update_connector_last_indexed(session, connector, update_last_indexed)
|
await update_connector_last_indexed(session, connector, update_last_indexed)
|
||||||
|
|
||||||
# Final commit for any remaining documents not yet committed in batches
|
# Final commit for any remaining documents not yet committed in batches
|
||||||
logger.info(f"Final commit: Total {documents_indexed} Confluence pages processed")
|
logger.info(
|
||||||
|
f"Final commit: Total {documents_indexed} Confluence pages processed"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
logger.info(
|
logger.info(
|
||||||
"Successfully committed all Confluence document changes to database"
|
"Successfully committed all Confluence document changes to database"
|
||||||
|
|
|
||||||
|
|
@ -461,10 +461,12 @@ async def index_discord_messages(
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Successfully indexed new channel {guild_name}#{channel_name} with {len(formatted_messages)} messages"
|
f"Successfully indexed new channel {guild_name}#{channel_name} with {len(formatted_messages)} messages"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} Discord channels processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} Discord channels processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -482,7 +484,9 @@ async def index_discord_messages(
|
||||||
await update_connector_last_indexed(session, connector, update_last_indexed)
|
await update_connector_last_indexed(session, connector, update_last_indexed)
|
||||||
|
|
||||||
# Final commit for any remaining documents not yet committed in batches
|
# Final commit for any remaining documents not yet committed in batches
|
||||||
logger.info(f"Final commit: Total {documents_indexed} Discord channels processed")
|
logger.info(
|
||||||
|
f"Final commit: Total {documents_indexed} Discord channels processed"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
# Prepare result message
|
# Prepare result message
|
||||||
|
|
|
||||||
|
|
@ -380,10 +380,12 @@ async def index_github_repos(
|
||||||
)
|
)
|
||||||
session.add(document)
|
session.add(document)
|
||||||
documents_processed += 1
|
documents_processed += 1
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_processed % 10 == 0:
|
if documents_processed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_processed} GitHub files processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_processed} GitHub files processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as repo_err:
|
except Exception as repo_err:
|
||||||
|
|
|
||||||
|
|
@ -406,10 +406,12 @@ async def index_google_calendar_events(
|
||||||
session.add(document)
|
session.add(document)
|
||||||
documents_indexed += 1
|
documents_indexed += 1
|
||||||
logger.info(f"Successfully indexed new event {event_summary}")
|
logger.info(f"Successfully indexed new event {event_summary}")
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} Google Calendar events processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} Google Calendar events processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -428,7 +430,9 @@ async def index_google_calendar_events(
|
||||||
await update_connector_last_indexed(session, connector, update_last_indexed)
|
await update_connector_last_indexed(session, connector, update_last_indexed)
|
||||||
|
|
||||||
# Final commit for any remaining documents not yet committed in batches
|
# Final commit for any remaining documents not yet committed in batches
|
||||||
logger.info(f"Final commit: Total {documents_indexed} Google Calendar events processed")
|
logger.info(
|
||||||
|
f"Final commit: Total {documents_indexed} Google Calendar events processed"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
await task_logger.log_task_success(
|
await task_logger.log_task_success(
|
||||||
|
|
|
||||||
|
|
@ -323,10 +323,12 @@ async def index_google_gmail_messages(
|
||||||
session.add(document)
|
session.add(document)
|
||||||
documents_indexed += 1
|
documents_indexed += 1
|
||||||
logger.info(f"Successfully indexed new email {summary_content}")
|
logger.info(f"Successfully indexed new email {summary_content}")
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} Gmail messages processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} Gmail messages processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -351,10 +351,12 @@ async def index_jira_issues(
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Successfully indexed new issue {issue_identifier} - {issue_title}"
|
f"Successfully indexed new issue {issue_identifier} - {issue_title}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} Jira issues processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} Jira issues processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -370,10 +370,12 @@ async def index_linear_issues(
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Successfully indexed new issue {issue_identifier} - {issue_title}"
|
f"Successfully indexed new issue {issue_identifier} - {issue_title}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} Linear issues processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} Linear issues processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -437,10 +437,12 @@ async def index_luma_events(
|
||||||
session.add(document)
|
session.add(document)
|
||||||
documents_indexed += 1
|
documents_indexed += 1
|
||||||
logger.info(f"Successfully indexed new event {event_name}")
|
logger.info(f"Successfully indexed new event {event_name}")
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} Luma events processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} Luma events processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -356,12 +356,14 @@ async def index_notion_pages(
|
||||||
|
|
||||||
documents_indexed += 1
|
documents_indexed += 1
|
||||||
logger.info(f"Successfully updated Notion page: {page_title}")
|
logger.info(f"Successfully updated Notion page: {page_title}")
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} documents processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} documents processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Document doesn't exist - create new one
|
# Document doesn't exist - create new one
|
||||||
|
|
@ -411,10 +413,12 @@ async def index_notion_pages(
|
||||||
session.add(document)
|
session.add(document)
|
||||||
documents_indexed += 1
|
documents_indexed += 1
|
||||||
logger.info(f"Successfully indexed new Notion page: {page_title}")
|
logger.info(f"Successfully indexed new Notion page: {page_title}")
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} documents processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} documents processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -353,12 +353,14 @@ async def index_slack_messages(
|
||||||
|
|
||||||
session.add(document)
|
session.add(document)
|
||||||
documents_indexed += 1
|
documents_indexed += 1
|
||||||
|
|
||||||
# Batch commit every 10 documents
|
# Batch commit every 10 documents
|
||||||
if documents_indexed % 10 == 0:
|
if documents_indexed % 10 == 0:
|
||||||
logger.info(f"Committing batch: {documents_indexed} Slack channels processed so far")
|
logger.info(
|
||||||
|
f"Committing batch: {documents_indexed} Slack channels processed so far"
|
||||||
|
)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Successfully indexed new channel {channel_name} with {len(formatted_messages)} messages"
|
f"Successfully indexed new channel {channel_name} with {len(formatted_messages)} messages"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ export function GoogleLoginButton() {
|
||||||
<h1 className="my-8 text-xl font-bold text-neutral-800 dark:text-neutral-100 md:text-4xl">
|
<h1 className="my-8 text-xl font-bold text-neutral-800 dark:text-neutral-100 md:text-4xl">
|
||||||
{t("welcome_back")}
|
{t("welcome_back")}
|
||||||
</h1>
|
</h1>
|
||||||
{/*
|
{/*
|
||||||
<motion.div
|
<motion.div
|
||||||
initial={{ opacity: 0, y: -5 }}
|
initial={{ opacity: 0, y: -5 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,11 @@ const DashboardPage = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Link className="flex flex-1 flex-col p-4 cursor-pointer" href={`/dashboard/${space.id}/documents`} key={space.id}>
|
<Link
|
||||||
|
className="flex flex-1 flex-col p-4 cursor-pointer"
|
||||||
|
href={`/dashboard/${space.id}/documents`}
|
||||||
|
key={space.id}
|
||||||
|
>
|
||||||
<div className="flex flex-1 flex-col justify-between p-1">
|
<div className="flex flex-1 flex-col justify-between p-1">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="font-medium text-lg">{space.name}</h3>
|
<h3 className="font-medium text-lg">{space.name}</h3>
|
||||||
|
|
|
||||||
|
|
@ -208,14 +208,16 @@ const ConnectorSelector = React.memo(
|
||||||
{getConnectorIcon(docType.type, "h-3 w-3")}
|
{getConnectorIcon(docType.type, "h-3 w-3")}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{selectedLiveConnectors.slice(0, 3 - selectedDocTypes.slice(0, 2).length).map((connector) => (
|
{selectedLiveConnectors
|
||||||
<div
|
.slice(0, 3 - selectedDocTypes.slice(0, 2).length)
|
||||||
key={connector.id}
|
.map((connector) => (
|
||||||
className="flex h-6 w-6 items-center justify-center rounded-full border-2 border-background bg-muted"
|
<div
|
||||||
>
|
key={connector.id}
|
||||||
{getConnectorIcon(connector.connector_type, "h-3 w-3")}
|
className="flex h-6 w-6 items-center justify-center rounded-full border-2 border-background bg-muted"
|
||||||
</div>
|
>
|
||||||
))}
|
{getConnectorIcon(connector.connector_type, "h-3 w-3")}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
<span className="text-xs font-medium">
|
<span className="text-xs font-medium">
|
||||||
{totalSelectedCount} {totalSelectedCount === 1 ? "source" : "sources"}
|
{totalSelectedCount} {totalSelectedCount === 1 ? "source" : "sources"}
|
||||||
|
|
@ -240,7 +242,7 @@ const ConnectorSelector = React.memo(
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{(isLoading || connectorsLoading) ? (
|
{isLoading || connectorsLoading ? (
|
||||||
<div className="flex justify-center py-8">
|
<div className="flex justify-center py-8">
|
||||||
<div className="animate-spin h-8 w-8 border-3 border-primary border-t-transparent rounded-full" />
|
<div className="animate-spin h-8 w-8 border-3 border-primary border-t-transparent rounded-full" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -293,9 +295,7 @@ const ConnectorSelector = React.memo(
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 text-left min-w-0">
|
<div className="flex-1 text-left min-w-0">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<p className="text-sm font-medium truncate">
|
<p className="text-sm font-medium truncate">{connector.name}</p>
|
||||||
{connector.name}
|
|
||||||
</p>
|
|
||||||
{isSelected && (
|
{isSelected && (
|
||||||
<div className="flex h-5 w-5 items-center justify-center rounded-full bg-primary">
|
<div className="flex h-5 w-5 items-center justify-center rounded-full bg-primary">
|
||||||
<Check className="h-3 w-3 text-primary-foreground" />
|
<Check className="h-3 w-3 text-primary-foreground" />
|
||||||
|
|
@ -590,7 +590,6 @@ const LLMSelector = React.memo(() => {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import Link from "next/link";
|
|
||||||
import Image from "next/image";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AlertCircle,
|
AlertCircle,
|
||||||
BookOpen,
|
BookOpen,
|
||||||
|
|
@ -20,6 +17,8 @@ import {
|
||||||
Trash2,
|
Trash2,
|
||||||
Undo2,
|
Undo2,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
import Image from "next/image";
|
||||||
|
import Link from "next/link";
|
||||||
import { memo, useMemo } from "react";
|
import { memo, useMemo } from "react";
|
||||||
|
|
||||||
import { Logo } from "@/components/Logo";
|
import { Logo } from "@/components/Logo";
|
||||||
|
|
@ -36,7 +35,6 @@ import {
|
||||||
SidebarMenuItem,
|
SidebarMenuItem,
|
||||||
} from "@/components/ui/sidebar";
|
} from "@/components/ui/sidebar";
|
||||||
|
|
||||||
|
|
||||||
// Map of icon names to their components
|
// Map of icon names to their components
|
||||||
export const iconMap: Record<string, LucideIcon> = {
|
export const iconMap: Record<string, LucideIcon> = {
|
||||||
BookOpen,
|
BookOpen,
|
||||||
|
|
@ -218,21 +216,21 @@ export const AppSidebar = memo(function AppSidebar({
|
||||||
<SidebarMenu>
|
<SidebarMenu>
|
||||||
<SidebarMenuItem>
|
<SidebarMenuItem>
|
||||||
<SidebarMenuButton asChild size="lg">
|
<SidebarMenuButton asChild size="lg">
|
||||||
<Link href="/" className="flex items-center gap-2 w-full">
|
<Link href="/" className="flex items-center gap-2 w-full">
|
||||||
<div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
|
<div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
|
||||||
<Image
|
<Image
|
||||||
src="/icon-128.png"
|
src="/icon-128.png"
|
||||||
alt="SurfSense logo"
|
alt="SurfSense logo"
|
||||||
width={32}
|
width={32}
|
||||||
height={32}
|
height={32}
|
||||||
className="rounded-lg"
|
className="rounded-lg"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid flex-1 text-left text-sm leading-tight">
|
<div className="grid flex-1 text-left text-sm leading-tight">
|
||||||
<span className="truncate font-medium">SurfSense</span>
|
<span className="truncate font-medium">SurfSense</span>
|
||||||
<span className="truncate text-xs">beta v0.0.8</span>
|
<span className="truncate text-xs">beta v0.0.8</span>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
</SidebarMenuItem>
|
</SidebarMenuItem>
|
||||||
</SidebarMenu>
|
</SidebarMenu>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue