mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
style: fix formatting issues
This commit is contained in:
parent
3c40c6e365
commit
c65cda24d7
7 changed files with 39 additions and 28 deletions
|
|
@ -123,7 +123,9 @@ async def list_all_permissions(
|
|||
for perm in Permission:
|
||||
# Extract category from permission value (e.g., "documents:read" -> "documents")
|
||||
category = perm.value.split(":")[0] if ":" in perm.value else "general"
|
||||
description = PERMISSION_DESCRIPTIONS.get(perm.value, f"Permission for {perm.value}")
|
||||
description = PERMISSION_DESCRIPTIONS.get(
|
||||
perm.value, f"Permission for {perm.value}"
|
||||
)
|
||||
|
||||
permissions.append(
|
||||
PermissionInfo(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||
from sqlalchemy.future import select
|
||||
|
||||
from app.agents.new_chat.chat_deepagent import create_surfsense_deep_agent
|
||||
from app.utils.content_utils import bootstrap_history_from_db
|
||||
from app.agents.new_chat.checkpointer import get_checkpointer
|
||||
from app.agents.new_chat.llm_config import (
|
||||
AgentConfig,
|
||||
|
|
@ -35,6 +34,7 @@ from app.services.chat_session_state_service import (
|
|||
)
|
||||
from app.services.connector_service import ConnectorService
|
||||
from app.services.new_streaming_service import VercelStreamingService
|
||||
from app.utils.content_utils import bootstrap_history_from_db
|
||||
|
||||
|
||||
def format_attachments_as_context(attachments: list[ChatAttachment]) -> str:
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ import { useMessagesElectric } from "@/hooks/use-messages-electric";
|
|||
// import { WriteTodosToolUI } from "@/components/tool-ui/write-todos";
|
||||
import { getBearerToken } from "@/lib/auth-utils";
|
||||
import { createAttachmentAdapter, extractAttachmentContent } from "@/lib/chat/attachment-adapter";
|
||||
import { convertToThreadMessage } from "@/lib/chat/message-utils";
|
||||
import {
|
||||
isPodcastGenerating,
|
||||
looksLikePodcastRequest,
|
||||
setActivePodcastTaskId,
|
||||
} from "@/lib/chat/podcast-state";
|
||||
import { convertToThreadMessage } from "@/lib/chat/message-utils";
|
||||
import {
|
||||
appendMessage,
|
||||
type ChatVisibility,
|
||||
|
|
@ -111,7 +111,6 @@ function extractMentionedDocuments(content: unknown): MentionedDocumentInfo[] {
|
|||
return [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tools that should render custom UI in the chat.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -115,13 +115,13 @@ import type {
|
|||
Membership,
|
||||
UpdateMembershipRequest,
|
||||
} from "@/contracts/types/members.types";
|
||||
import type { PermissionInfo } from "@/contracts/types/permissions.types";
|
||||
import type {
|
||||
CreateRoleRequest,
|
||||
DeleteRoleRequest,
|
||||
Role,
|
||||
UpdateRoleRequest,
|
||||
} from "@/contracts/types/roles.types";
|
||||
import type { PermissionInfo } from "@/contracts/types/permissions.types";
|
||||
import { invitesApiService } from "@/lib/apis/invites-api.service";
|
||||
import { rolesApiService } from "@/lib/apis/roles-api.service";
|
||||
import { trackSearchSpaceInviteSent, trackSearchSpaceUsersViewed } from "@/lib/posthog/events";
|
||||
|
|
@ -980,11 +980,7 @@ function RolesTab({
|
|||
>
|
||||
{/* Create Role Button / Section */}
|
||||
{canCreate && !showCreateRole && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
className="flex justify-end"
|
||||
>
|
||||
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} className="flex justify-end">
|
||||
<Button onClick={() => setShowCreateRole(true)} className="gap-2">
|
||||
<Plus className="h-4 w-4" />
|
||||
Create Custom Role
|
||||
|
|
@ -1701,15 +1697,18 @@ function CreateRoleSection({
|
|||
);
|
||||
}, []);
|
||||
|
||||
const applyPreset = useCallback((presetKey: keyof typeof ROLE_PRESETS) => {
|
||||
const preset = ROLE_PRESETS[presetKey];
|
||||
setSelectedPermissions(preset.permissions);
|
||||
if (!name.trim()) {
|
||||
setName(preset.name);
|
||||
setDescription(preset.description);
|
||||
}
|
||||
toast.success(`Applied ${preset.name} preset`);
|
||||
}, [name]);
|
||||
const applyPreset = useCallback(
|
||||
(presetKey: keyof typeof ROLE_PRESETS) => {
|
||||
const preset = ROLE_PRESETS[presetKey];
|
||||
setSelectedPermissions(preset.permissions);
|
||||
if (!name.trim()) {
|
||||
setName(preset.name);
|
||||
setDescription(preset.description);
|
||||
}
|
||||
toast.success(`Applied ${preset.name} preset`);
|
||||
},
|
||||
[name]
|
||||
);
|
||||
|
||||
const getCategoryStats = useCallback(
|
||||
(category: string) => {
|
||||
|
|
@ -1857,10 +1856,7 @@ function CreateRoleSection({
|
|||
const perms = groupedPermissions[category] || [];
|
||||
|
||||
return (
|
||||
<div
|
||||
key={category}
|
||||
className="rounded-lg border bg-card overflow-hidden"
|
||||
>
|
||||
<div key={category} className="rounded-lg border bg-card overflow-hidden">
|
||||
{/* Category Header */}
|
||||
<div
|
||||
className={cn(
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const GoogleLogo = ({ className }: { className?: string }) => (
|
|||
);
|
||||
|
||||
interface SignInButtonProps {
|
||||
/**
|
||||
/**
|
||||
* - "desktop": Hidden on mobile, visible on md+ (for navbar with separate mobile menu)
|
||||
* - "mobile": Full width, always visible (for mobile menu)
|
||||
* - "compact": Always visible, compact size (for headers)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@ import { currentThreadAtom, setThreadVisibilityAtom } from "@/atoms/chat/current
|
|||
import { Button } from "@/components/ui/button";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { type ChatVisibility, type ThreadRecord, updateThreadVisibility } from "@/lib/chat/thread-persistence";
|
||||
import {
|
||||
type ChatVisibility,
|
||||
type ThreadRecord,
|
||||
updateThreadVisibility,
|
||||
} from "@/lib/chat/thread-persistence";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface ChatShareButtonProps {
|
||||
|
|
@ -107,7 +111,7 @@ export function ChatShareButton({ thread, onVisibilityChange, className }: ChatS
|
|||
publicShareEnabled: response.enabled,
|
||||
publicShareToken: response.share_token,
|
||||
}));
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
console.error("Failed to toggle public share:", error);
|
||||
}
|
||||
}, [thread, isPublicEnabled, togglePublicShare, setCurrentThreadState]);
|
||||
|
|
@ -126,7 +130,11 @@ export function ChatShareButton({ thread, onVisibilityChange, className }: ChatS
|
|||
}
|
||||
|
||||
const CurrentIcon = isPublicEnabled ? Globe : currentVisibility === "PRIVATE" ? User : Users;
|
||||
const buttonLabel = isPublicEnabled ? "Public" : currentVisibility === "PRIVATE" ? "Private" : "Shared";
|
||||
const buttonLabel = isPublicEnabled
|
||||
? "Public"
|
||||
: currentVisibility === "PRIVATE"
|
||||
? "Private"
|
||||
: "Shared";
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
|
|
|
|||
|
|
@ -279,7 +279,13 @@ export function isChatCloneFailedMetadata(metadata: unknown): metadata is ChatCl
|
|||
export function parseInboxItemMetadata(
|
||||
type: InboxItemTypeEnum,
|
||||
metadata: unknown
|
||||
): ConnectorIndexingMetadata | DocumentProcessingMetadata | NewMentionMetadata | ChatClonedMetadata | ChatCloneFailedMetadata | null {
|
||||
):
|
||||
| ConnectorIndexingMetadata
|
||||
| DocumentProcessingMetadata
|
||||
| NewMentionMetadata
|
||||
| ChatClonedMetadata
|
||||
| ChatCloneFailedMetadata
|
||||
| null {
|
||||
switch (type) {
|
||||
case "connector_indexing": {
|
||||
const result = connectorIndexingMetadata.safeParse(metadata);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue