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