mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +02:00
chore: ran linting
This commit is contained in:
parent
5ab672b8ff
commit
e2dd80c604
6 changed files with 48 additions and 72 deletions
|
|
@ -651,9 +651,7 @@ async def index_discord_messages(
|
|||
# PHASE 2: Process each batch document one by one
|
||||
# Each document transitions: pending → processing → ready/failed
|
||||
# =======================================================================
|
||||
logger.info(
|
||||
f"Phase 2: Processing {len(batches_to_process)} batch documents"
|
||||
)
|
||||
logger.info(f"Phase 2: Processing {len(batches_to_process)} batch documents")
|
||||
|
||||
for item in batches_to_process:
|
||||
# Send heartbeat periodically
|
||||
|
|
|
|||
|
|
@ -357,9 +357,7 @@ async def index_slack_messages(
|
|||
# Group messages into batches of SLACK_BATCH_SIZE
|
||||
# Each batch becomes a single document with conversation context
|
||||
# =======================================================
|
||||
for batch_start in range(
|
||||
0, len(formatted_messages), SLACK_BATCH_SIZE
|
||||
):
|
||||
for batch_start in range(0, len(formatted_messages), SLACK_BATCH_SIZE):
|
||||
batch = formatted_messages[
|
||||
batch_start : batch_start + SLACK_BATCH_SIZE
|
||||
]
|
||||
|
|
@ -377,9 +375,7 @@ async def index_slack_messages(
|
|||
# channel_id + first message ts + last message ts
|
||||
first_msg_ts = batch[0].get("timestamp", "")
|
||||
last_msg_ts = batch[-1].get("timestamp", "")
|
||||
unique_identifier = (
|
||||
f"{channel_id}_{first_msg_ts}_{last_msg_ts}"
|
||||
)
|
||||
unique_identifier = f"{channel_id}_{first_msg_ts}_{last_msg_ts}"
|
||||
unique_identifier_hash = generate_unique_identifier_hash(
|
||||
DocumentType.SLACK_CONNECTOR,
|
||||
unique_identifier,
|
||||
|
|
@ -392,10 +388,8 @@ async def index_slack_messages(
|
|||
)
|
||||
|
||||
# Check if document with this unique identifier already exists
|
||||
existing_document = (
|
||||
await check_document_by_unique_identifier(
|
||||
session, unique_identifier_hash
|
||||
)
|
||||
existing_document = await check_document_by_unique_identifier(
|
||||
session, unique_identifier_hash
|
||||
)
|
||||
|
||||
if existing_document:
|
||||
|
|
@ -405,9 +399,7 @@ async def index_slack_messages(
|
|||
if not DocumentStatus.is_state(
|
||||
existing_document.status, DocumentStatus.READY
|
||||
):
|
||||
existing_document.status = (
|
||||
DocumentStatus.ready()
|
||||
)
|
||||
existing_document.status = DocumentStatus.ready()
|
||||
documents_skipped += 1
|
||||
continue
|
||||
|
||||
|
|
@ -440,10 +432,8 @@ async def index_slack_messages(
|
|||
# Document doesn't exist by unique_identifier_hash
|
||||
# Check if a document with the same content_hash exists (from another connector)
|
||||
with session.no_autoflush:
|
||||
duplicate_by_content = (
|
||||
await check_duplicate_document_by_hash(
|
||||
session, content_hash
|
||||
)
|
||||
duplicate_by_content = await check_duplicate_document_by_hash(
|
||||
session, content_hash
|
||||
)
|
||||
|
||||
if duplicate_by_content:
|
||||
|
|
@ -496,12 +486,8 @@ async def index_slack_messages(
|
|||
"channel_id": channel_id,
|
||||
"first_message_ts": first_msg_ts,
|
||||
"last_message_ts": last_msg_ts,
|
||||
"first_message_time": batch[0].get(
|
||||
"datetime", "Unknown"
|
||||
),
|
||||
"last_message_time": batch[-1].get(
|
||||
"datetime", "Unknown"
|
||||
),
|
||||
"first_message_time": batch[0].get("datetime", "Unknown"),
|
||||
"last_message_time": batch[-1].get("datetime", "Unknown"),
|
||||
"message_count": len(batch),
|
||||
"start_date": start_date_str,
|
||||
"end_date": end_date_str,
|
||||
|
|
@ -538,9 +524,7 @@ async def index_slack_messages(
|
|||
# PHASE 2: Process each batch document one by one
|
||||
# Each document transitions: pending → processing → ready/failed
|
||||
# =======================================================================
|
||||
logger.info(
|
||||
f"Phase 2: Processing {len(batches_to_process)} batch documents"
|
||||
)
|
||||
logger.info(f"Phase 2: Processing {len(batches_to_process)} batch documents")
|
||||
|
||||
for item in batches_to_process:
|
||||
# Send heartbeat periodically
|
||||
|
|
@ -621,9 +605,7 @@ async def index_slack_messages(
|
|||
)
|
||||
try:
|
||||
await session.commit()
|
||||
logger.info(
|
||||
"Successfully committed all Slack document changes to database"
|
||||
)
|
||||
logger.info("Successfully committed all Slack document changes to database")
|
||||
except Exception as e:
|
||||
# Handle any remaining integrity errors gracefully (race conditions, etc.)
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -51,8 +51,7 @@ export function RowActions({
|
|||
document.status?.state === "pending" || document.status?.state === "processing";
|
||||
|
||||
// FILE documents that failed processing cannot be edited
|
||||
const isFileFailed =
|
||||
document.document_type === "FILE" && document.status?.state === "failed";
|
||||
const isFileFailed = document.document_type === "FILE" && document.status?.state === "failed";
|
||||
|
||||
// SURFSENSE_DOCS are system-managed and should not show delete at all
|
||||
const shouldShowDelete = !NON_DELETABLE_DOCUMENT_TYPES.includes(
|
||||
|
|
@ -212,7 +211,8 @@ export function RowActions({
|
|||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Delete document?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
This action cannot be undone. This will permanently delete this document from your search space.
|
||||
This action cannot be undone. This will permanently delete this document from your
|
||||
search space.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
|
|
|
|||
|
|
@ -98,9 +98,9 @@ export function UserDropdown({
|
|||
className="text-xs md:text-sm"
|
||||
disabled={isLoggingOut}
|
||||
>
|
||||
{isLoggingOut ? (
|
||||
<Spinner size="sm" className="mr-2" />
|
||||
) : (
|
||||
{isLoggingOut ? (
|
||||
<Spinner size="sm" className="mr-2" />
|
||||
) : (
|
||||
<LogOut className="mr-2 h-3.5 w-3.5 md:h-4 md:w-4" />
|
||||
)}
|
||||
{isLoggingOut ? "Logging out..." : "Log out"}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
Check,
|
||||
ChevronUp,
|
||||
Languages,
|
||||
Laptop,
|
||||
LogOut,
|
||||
Moon,
|
||||
Settings,
|
||||
Sun,
|
||||
} from "lucide-react";
|
||||
import { Check, ChevronUp, Languages, Laptop, LogOut, Moon, Settings, Sun } from "lucide-react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
|
|
@ -264,18 +255,18 @@ export function SidebarUserProfile({
|
|||
|
||||
<DropdownMenuSeparator />
|
||||
|
||||
<DropdownMenuItem onClick={handleLogout} disabled={isLoggingOut}>
|
||||
{isLoggingOut ? (
|
||||
<Spinner size="sm" className="mr-2" />
|
||||
) : (
|
||||
<LogOut className="mr-2 h-4 w-4" />
|
||||
)}
|
||||
{isLoggingOut ? t("loggingOut") : t("logout")}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
);
|
||||
<DropdownMenuItem onClick={handleLogout} disabled={isLoggingOut}>
|
||||
{isLoggingOut ? (
|
||||
<Spinner size="sm" className="mr-2" />
|
||||
) : (
|
||||
<LogOut className="mr-2 h-4 w-4" />
|
||||
)}
|
||||
{isLoggingOut ? t("loggingOut") : t("logout")}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Expanded view
|
||||
|
|
@ -386,16 +377,16 @@ export function SidebarUserProfile({
|
|||
|
||||
<DropdownMenuSeparator />
|
||||
|
||||
<DropdownMenuItem onClick={handleLogout} disabled={isLoggingOut}>
|
||||
{isLoggingOut ? (
|
||||
<Spinner size="sm" className="mr-2" />
|
||||
) : (
|
||||
<LogOut className="mr-2 h-4 w-4" />
|
||||
)}
|
||||
{isLoggingOut ? t("loggingOut") : t("logout")}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
<DropdownMenuItem onClick={handleLogout} disabled={isLoggingOut}>
|
||||
{isLoggingOut ? (
|
||||
<Spinner size="sm" className="mr-2" />
|
||||
) : (
|
||||
<LogOut className="mr-2 h-4 w-4" />
|
||||
)}
|
||||
{isLoggingOut ? t("loggingOut") : t("logout")}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,12 @@ export function PublicChatFooter({ shareToken }: PublicChatFooterProps) {
|
|||
|
||||
return (
|
||||
<div className="fixed bottom-6 left-1/2 z-50 -translate-x-1/2">
|
||||
<Button size="lg" onClick={handleCopyAndContinue} disabled={isCloning} className="gap-2 rounded-full px-6 shadow-lg transition-all duration-200 hover:scale-[1.02] hover:shadow-xl hover:brightness-110 hover:bg-primary">
|
||||
<Button
|
||||
size="lg"
|
||||
onClick={handleCopyAndContinue}
|
||||
disabled={isCloning}
|
||||
className="gap-2 rounded-full px-6 shadow-lg transition-all duration-200 hover:scale-[1.02] hover:shadow-xl hover:brightness-110 hover:bg-primary"
|
||||
>
|
||||
{isCloning ? <Spinner size="sm" /> : <Copy className="size-4" />}
|
||||
Copy and continue this chat
|
||||
</Button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue