diff --git a/surfsense_backend/app/tasks/chat/stream_new_chat.py b/surfsense_backend/app/tasks/chat/stream_new_chat.py
index 81c801959..1b2a4cfbb 100644
--- a/surfsense_backend/app/tasks/chat/stream_new_chat.py
+++ b/surfsense_backend/app/tasks/chat/stream_new_chat.py
@@ -1401,14 +1401,15 @@ async def stream_new_chat(
continue
connector_lines.append(
f' - connector_id={connector_id}, connector_type="{connector_type}", '
- f'account="{account_name or ""}"'
+ f'account_name="{account_name or ""}"'
)
if connector_lines:
context_parts.append(
"\n"
"The user selected these exact connector accounts with @. "
- "For read, write, or HITL tool calls involving these services, "
- "prefer the matching connector_id instead of guessing from available accounts:\n"
+ "These entries are selection metadata, not retrieved connector content. "
+ "When a connector-backed tool needs an account, use the matching "
+ "connector_id from this list if the tool supports connector_id:\n"
+ "\n".join(connector_lines)
+ "\n"
)
diff --git a/surfsense_web/components/new-chat/composer-suggestion-popup.tsx b/surfsense_web/components/new-chat/composer-suggestion-popup.tsx
index 2909fbf86..3fdf48875 100644
--- a/surfsense_web/components/new-chat/composer-suggestion-popup.tsx
+++ b/surfsense_web/components/new-chat/composer-suggestion-popup.tsx
@@ -31,7 +31,7 @@ function ComposerSuggestionPopoverContent({
onCloseAutoFocus?.(event);
}}
className={cn(
- "w-[232px] overflow-hidden rounded-md border border-popover-border bg-popover p-0 text-popover-foreground shadow-md sm:w-[264px]",
+ "w-[232px] select-none overflow-hidden rounded-md border border-popover-border bg-popover p-0 text-popover-foreground shadow-md sm:w-[264px]",
"data-[state=open]:!animate-none data-[state=closed]:!animate-none data-[state=open]:!duration-0 data-[state=closed]:!duration-0",
className
)}
@@ -145,18 +145,24 @@ function ComposerSuggestionMessage({
);
}
-function ComposerSuggestionSkeleton() {
+function ComposerSuggestionSkeleton({
+ rows = 5,
+ mobileRows = 3,
+}: {
+ rows?: number;
+ mobileRows?: number;
+}) {
return (
- {["a", "b", "c", "d", "e"].map((id, index) => (
+ {Array.from({ length: rows }, (_, index) => `skeleton-row-${index}`).map((id, index) => (
= 3 && "hidden sm:flex"
+ index >= mobileRows && "hidden sm:flex"
)}
>
diff --git a/surfsense_web/components/new-chat/document-mention-picker.tsx b/surfsense_web/components/new-chat/document-mention-picker.tsx
index 3b96a7cd2..c26e51922 100644
--- a/surfsense_web/components/new-chat/document-mention-picker.tsx
+++ b/surfsense_web/components/new-chat/document-mention-picker.tsx
@@ -438,7 +438,7 @@ export const DocumentMentionPicker = forwardRef<
() => new Set(initialSelectedDocuments.map((d) => getMentionDocKey(d))),
[initialSelectedDocuments]
);
- const showSurfsenseDocsRootRef = useRef((surfsenseDocs?.items?.length ?? 0) > 0);
+ const showSurfsenseDocsRoot = surfsenseDocsList.length > 0;
const selectMention = useCallback(
(mention: MentionedDocumentInfo) => {
@@ -463,7 +463,7 @@ export const DocumentMentionPicker = forwardRef<
const rootNodes = useMemo[]>(
() => {
const nodes: ComposerSuggestionNode[] = [...recentRootNodes];
- if (showSurfsenseDocsRootRef.current) {
+ if (showSurfsenseDocsRoot) {
nodes.push({
id: "surfsense-docs",
label: "SurfSense Docs",
@@ -496,7 +496,7 @@ export const DocumentMentionPicker = forwardRef<
);
return nodes;
},
- [activeConnectors.length, recentRootNodes]
+ [activeConnectors.length, recentRootNodes, showSurfsenseDocsRoot]
);
const searchNodes = useMemo[]>(() => {
@@ -680,11 +680,18 @@ export const DocumentMentionPicker = forwardRef<
[canLoadMoreDocuments, hasMore, isLoadingMore, loadNextPage]
);
+ const isRootBrowseView = !hasSearch && view.kind === "root";
+ const isVisibleViewLoading = hasSearch
+ ? isTitleSearchLoading || isSurfsenseDocsLoading || isConnectorsLoading
+ : view.kind === "surfsense-docs"
+ ? isSurfsenseDocsLoading
+ : view.kind === "files-folders"
+ ? isTitleSearchLoading
+ : view.kind === "connectors" || view.kind === "connector-type"
+ ? isConnectorsLoading
+ : false;
const actualLoading =
- (isTitleSearchLoading || isSurfsenseDocsLoading || isConnectorsLoading) &&
- !isSingleCharSearch &&
- visibleNodes.length === 0 &&
- (view.kind === "root" || hasSearch);
+ isVisibleViewLoading && !isSingleCharSearch && visibleNodes.length === 0 && !isRootBrowseView;
const title =
hasSearch || view.kind === "root"
@@ -703,9 +710,10 @@ export const DocumentMentionPicker = forwardRef<
onScroll={handleScroll}
role="listbox"
tabIndex={-1}
+ className={isRootBrowseView ? "max-h-none overflow-visible sm:max-h-none" : undefined}
>
{actualLoading ? (
-
+
) : (
{title ? (
diff --git a/surfsense_web/components/new-chat/prompt-picker.tsx b/surfsense_web/components/new-chat/prompt-picker.tsx
index 54d44662c..986a5d608 100644
--- a/surfsense_web/components/new-chat/prompt-picker.tsx
+++ b/surfsense_web/components/new-chat/prompt-picker.tsx
@@ -127,7 +127,7 @@ export const PromptPicker = forwardRef(funct
return (
{isLoading ? (
-
+
) : isError ? (
Failed to load prompts
) : filtered.length === 0 ? (