-
-
Notifications
You must be signed in to change notification settings - Fork 839
feat(removed): sub_section_writer agent #442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Its bad and not needed.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR removes multi-report research modes (REPORT_GENERAL, REPORT_DEEP, REPORT_DEEPER) and their entire sub-section generation infrastructure from both backend and frontend, retaining only Q&A functionality. Additionally, it normalizes frontend internationalization key quoting from single to double quotes across the codebase. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ReformulateNode as reformulate_user_query
participant QNANode as handle_qna_workflow
participant FollowUpNode as generate_further_questions
participant Output
User->>ReformulateNode: User Query
ReformulateNode->>QNANode: Reformulated Query
QNANode->>FollowUpNode: QNA Results + Documents
FollowUpNode->>Output: Final Report + Follow-up Questions
rect rgb(200, 220, 240)
note over ReformulateNode,FollowUpNode: Linear Q&A Flow (Simplified)<br/>Previously: Multi-branch with outline,<br/>section processing, report modes removed
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Areas requiring extra attention:
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by RecurseML
🔍 Review performed on 5ac6ebf..81ddc81
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (50)
• surfsense_backend/README.md
• surfsense_backend/app/agents/researcher/configuration.py
• surfsense_backend/app/agents/researcher/graph.py
• surfsense_backend/app/agents/researcher/nodes.py
• surfsense_backend/app/agents/researcher/prompts.py
• surfsense_backend/app/agents/researcher/state.py
• surfsense_backend/app/agents/researcher/sub_section_writer/__init__.py
• surfsense_backend/app/agents/researcher/sub_section_writer/configuration.py
• surfsense_backend/app/agents/researcher/sub_section_writer/graph.py
• surfsense_backend/app/agents/researcher/sub_section_writer/nodes.py
• surfsense_backend/app/agents/researcher/sub_section_writer/prompts.py
• surfsense_backend/app/agents/researcher/sub_section_writer/state.py
• surfsense_backend/app/agents/researcher/utils.py
• surfsense_backend/app/db.py
• surfsense_backend/app/tasks/stream_connector_search_results.py
• surfsense_backend/app/utils/validators.py
• surfsense_web/README.md
• surfsense_web/app/(home)/login/GoogleLoginButton.tsx
• surfsense_web/app/(home)/login/LocalLoginForm.tsx
• surfsense_web/app/(home)/login/page.tsx
• surfsense_web/app/(home)/register/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/(manage)/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsFilters.tsx
• surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx
• surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/PaginationControls.tsx
• surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/documents/upload/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/documents/webpage/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/documents/youtube/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/onboard/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/researcher/[[...chat_id]]/page.tsx
• surfsense_web/app/dashboard/page.tsx
• surfsense_web/app/layout.tsx
• surfsense_web/components/LanguageSwitcher.tsx
• surfsense_web/components/chat/ChatInputGroup.tsx
• surfsense_web/components/chat/ChatInterface.tsx
• surfsense_web/components/chat/ConnectorComponents.tsx
• surfsense_web/components/chat/types.ts
• surfsense_web/components/dashboard-breadcrumb.tsx
• surfsense_web/components/homepage/footer-new.tsx
• surfsense_web/components/onboard/add-provider-step.tsx
• surfsense_web/components/onboard/assign-roles-step.tsx
• surfsense_web/components/providers/I18nProvider.tsx
• surfsense_web/components/sidebar/AppSidebarProvider.tsx
• surfsense_web/components/sidebar/nav-main.tsx
• surfsense_web/components/sidebar/nav-projects.tsx
• surfsense_web/components/sidebar/nav-secondary.tsx
⏭️ Files skipped (7)
| Locations |
|---|
surfsense_web/contexts/LocaleContext.tsx |
surfsense_web/i18n/request.ts |
surfsense_web/i18n/routing.ts |
surfsense_web/messages/en.json |
surfsense_web/messages/zh.json |
surfsense_web/middleware.ts |
surfsense_web/next.config.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
surfsense_web/components/dashboard-breadcrumb.tsx (1)
100-110: Fix hardcoded strings to use translations.Lines 102 and 106 contain hardcoded English strings
"Connectors"and"Add Connector"instead of using the translation function. This breaks i18n consistency—users in non-English locales will see these labels in English while the rest of the breadcrumbs are translated.Apply this diff to fix the inconsistency:
const connectorLabel = connectorLabels[connectorType] || connectorType; breadcrumbs.push({ - label: "Connectors", + label: t("connectors"), href: `/dashboard/${segments[1]}/connectors`, }); breadcrumbs.push({ - label: "Add Connector", + label: t("add_connector"), href: `/dashboard/${segments[1]}/connectors/add`, }); breadcrumbs.push({ label: connectorLabel });surfsense_web/app/dashboard/[search_space_id]/connectors/(manage)/page.tsx (1)
143-151: Guard against invalid date ranges before indexingPrevent start > end; give actionable feedback.
try { setIndexingConnectorId(selectedConnectorForIndexing); - const startDateStr = startDate ? format(startDate, "yyyy-MM-dd") : undefined; - const endDateStr = endDate ? format(endDate, "yyyy-MM-dd") : undefined; + if (startDate && endDate && startDate > endDate) { + toast.error(t("invalid_date_range")); // add i18n key + setIndexingConnectorId(null); + return; + } + const startDateStr = startDate ? format(startDate, "yyyy-MM-dd") : undefined; + const endDateStr = endDate ? format(endDate, "yyyy-MM-dd") : undefined;If you’d like, I can add min/max props to calendars to enforce ordering.
♻️ Duplicate comments (1)
surfsense_web/messages/zh.json (1)
218-226: Mirror EN: drop researcher mode strings if feature is gone.If multi-report modes were removed, delete these zh keys as well to keep locales in sync.
🧹 Nitpick comments (19)
surfsense_web/components/homepage/footer-new.tsx (1)
91-179: Well-structured footer layout with proper React best practices.The component correctly includes key props on all mapped list items, ensuring React can properly reconcile the DOM. The layout is logically organized into sections with proper semantic structure.
Consider using template literals for keys to improve clarity and align with modern JavaScript conventions:
- <li key={"pages" + idx} className="list-none"> + <li key={`pages-${idx}`} className="list-none">This is purely a stylistic improvement and entirely optional.
surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx (1)
145-145: Consider translating remaining hardcoded strings for i18n completeness.While this PR successfully normalizes translation key quotes, several English strings remain hardcoded, such as "Log details" (line 145), "Close" (line 153), toast messages (lines 407-433), and loading states (lines 870, 887, 889). For full internationalization coverage, these could be moved to translation keys as well.
Also applies to: 153-153, 407-408, 418-418, 420-420, 427-427, 433-433, 870-870, 887-887, 889-889
surfsense_web/components/onboard/assign-roles-step.tsx (1)
221-245: LGTM! Trailing comma follows best practices.The quote normalization and trailing comma addition (line 240) are both positive changes. The trailing comma in the object literal is considered a best practice for multi-line objects.
React key requirement is properly satisfied at line 228 with
key={key}.Optional: Remove unused map parameter.
Line 226 includes an unused
_indexparameter in the map callback. Since it's not used (indicated by the underscore prefix), you could simplify the arrow function:-{Object.keys(ROLE_DESCRIPTIONS).map((key, _index) => ( +{Object.keys(ROLE_DESCRIPTIONS).map((key) => (surfsense_web/messages/zh.json (1)
682-685: Verify split “collab_*” parts render correctly in Chinese.
collab_part3is empty; if the UI concatenates/animates parts, confirm this yields the intended “协作” without layout glitches. If not required, prefer a single localized string to avoid brittle splits.surfsense_web/contexts/LocaleContext.tsx (1)
8-8: DeriveLocalefrom routing to avoid duplication/drift.Source the union from your routing config so adding a new locale stays type-safe.
Apply this change:
-import type React from "react"; +import type React from "react"; +import { routing } from "../i18n/routing"; -type Locale = "en" | "zh"; +type Locale = (typeof routing.locales)[number];surfsense_web/components/sidebar/AppSidebarProvider.tsx (1)
101-118: Localize the “Delete” action label for chat items.Use
tCommon("delete")for consistency with the dialog/button.- actions: [ - { - name: "Delete", + actions: [ + { + name: tCommon("delete"), icon: "Trash2", onClick: () => { setChatToDelete({ id: chat.id, name: chat.title || `Chat ${chat.id}` }); setShowDeleteDialog(true); }, }, ]surfsense_web/messages/en.json (1)
218-226: Remove stale researcher mode keys from translation files.These mode keys (
mode_general,mode_general_short,mode_deep,mode_deep_short,mode_deeper,mode_deeper_short) are unused throughout the codebase—no code references exist. Remove them from:
surfsense_web/messages/en.json(lines 220–225)surfsense_web/messages/zh.json(lines 220–225)surfsense_web/components/LanguageSwitcher.tsx (1)
31-33: Remove unsafe cast; type the handler to the locale unionAvoid bypassing type-safety with a cast.
-const handleLanguageChange = (newLocale: string) => { - setLocale(newLocale as "en" | "zh"); -}; +type LocaleCode = "en" | "zh"; +const handleLanguageChange = (newLocale: LocaleCode) => { + setLocale(newLocale); +};surfsense_web/app/dashboard/[search_space_id]/connectors/(manage)/page.tsx (5)
69-81: Use user’s locale for date/time, not hardcoded "en-US"Prefer next-intl’s formatter for consistency.
-import { useTranslations } from "next-intl"; +import { useTranslations, useFormatter } from "next-intl"; ... -// Helper function to format date with time -const formatDateTime = (dateString: string | null): string => { - if (!dateString) return t("never"); - const date = new Date(dateString); - return new Intl.DateTimeFormat("en-US", { - year: "numeric", - month: "short", - day: "numeric", - hour: "2-digit", - minute: "2-digit", - }).format(date); -}; +// Helper function to format date with time in the active locale +const f = useFormatter(); +const formatDateTime = (dateString: string | null): string => { + if (!dateString) return t("never"); + return f.dateTime(new Date(dateString), { dateStyle: "medium", timeStyle: "short" }); +};
151-151: Don’t surface raw error messages to end usersLeaking error.message can reveal internals. Log it; show a generic, localized toast.
- toast.error(error instanceof Error ? error.message : t("indexing_failed")); + console.error(error); + toast.error(t("indexing_failed"));Also applies to: 168-169
317-340: Localize status strings in periodic column"Enabled", "Disabled", "Runs every … minutes", "Next:" are hardcoded. Use t/tCommon keys for consistency.
I can draft keys and a small helper to render localized frequency/tooltips. Based on coding guidelines.
229-233: Internationalize success toasts for periodic settingsThese strings should use t/tCommon and live in messages files.
- toast.success( - periodicEnabled - ? "Periodic indexing enabled successfully" - : "Periodic indexing disabled successfully" - ); + toast.success( + periodicEnabled ? t("periodic_enabled_success") : t("periodic_disabled_success") + );
584-686: Periodic Indexing dialog strings are not localizedLabels, placeholders, preview text, and buttons are English-only. Convert to t/tCommon for full i18n.
If helpful, I’ll generate a patch mapping all literals here to translation keys and seed en/zh JSON.
surfsense_web/i18n/request.ts (2)
10-11: Drop unnecessary await on requestLocaleIf requestLocale is a string (as in next-intl 3), awaiting is redundant and weakens types.
-export default getRequestConfig(async ({ requestLocale }) => { - // This typically corresponds to the `[locale]` segment - let locale = await requestLocale; +export default getRequestConfig(async ({ requestLocale }) => { + // This typically corresponds to the `[locale]` segment + let locale = requestLocale;If your next-intl version provides a Promise here, ignore; otherwise this keeps types clean.
13-15: Avoidas any; validate with a typed guardStrengthen the check and keep the dynamic import safe.
- if (!locale || !routing.locales.includes(locale as any)) { + type SupportedLocale = (typeof routing.locales)[number]; + const isSupported = (l: unknown): l is SupportedLocale => + typeof l === "string" && (routing.locales as readonly string[]).includes(l); + if (!isSupported(locale)) { locale = routing.defaultLocale; }surfsense_web/components/sidebar/nav-projects.tsx (4)
167-167: Use a guaranteed-unique, stable keyFallback to name can collide. Prefer id or url.
- filteredChats.map((chat) => <ChatItemComponent key={chat.id || chat.name} chat={chat} />) + filteredChats.map((chat) => ( + <ChatItemComponent key={chat.id ?? chat.url} chat={chat} /> +))As per coding guidelines.
91-99: Remove redundant key inside ChatItemComponentThe list key is applied at the callsite; inner key is unnecessary.
- <SidebarMenuItem key={chat.id ? `chat-${chat.id}` : `chat-${chat.name}`}> + <SidebarMenuItem>
116-133: Don’t detect “delete” by string matching; add a structured action kindString includes("delete") breaks with i18n and is brittle.
-interface ChatAction { - name: string; - icon: string; - onClick: () => void; -} +interface ChatAction { + name: string; // display + icon: string; + kind?: "delete" | "navigate" | "custom"; + onClick: () => void; +} ... - const isDeleteAction = action.name.toLowerCase().includes("delete"); + const isDeleteAction = action.kind === "delete";I can follow up with a repo-wide codemod if needed.
106-107: Localize “More” and “Deleting…”These should use t/tCommon for consistency.
- <span className="sr-only">More</span> + <span className="sr-only">{t("more")}</span> ... - <span>{isDeletingChat && isDeleteAction ? "Deleting..." : action.name}</span> + <span>{isDeletingChat && isDeleteAction ? t("deleting") : action.name}</span>Also applies to: 132-133
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (57)
surfsense_backend/README.md(0 hunks)surfsense_backend/app/agents/researcher/configuration.py(0 hunks)surfsense_backend/app/agents/researcher/graph.py(2 hunks)surfsense_backend/app/agents/researcher/nodes.py(2 hunks)surfsense_backend/app/agents/researcher/prompts.py(1 hunks)surfsense_backend/app/agents/researcher/state.py(0 hunks)surfsense_backend/app/agents/researcher/sub_section_writer/__init__.py(0 hunks)surfsense_backend/app/agents/researcher/sub_section_writer/configuration.py(0 hunks)surfsense_backend/app/agents/researcher/sub_section_writer/graph.py(0 hunks)surfsense_backend/app/agents/researcher/sub_section_writer/nodes.py(0 hunks)surfsense_backend/app/agents/researcher/sub_section_writer/prompts.py(0 hunks)surfsense_backend/app/agents/researcher/sub_section_writer/state.py(0 hunks)surfsense_backend/app/agents/researcher/utils.py(0 hunks)surfsense_backend/app/db.py(0 hunks)surfsense_backend/app/tasks/stream_connector_search_results.py(0 hunks)surfsense_backend/app/utils/validators.py(1 hunks)surfsense_web/README.md(0 hunks)surfsense_web/app/(home)/login/GoogleLoginButton.tsx(4 hunks)surfsense_web/app/(home)/login/LocalLoginForm.tsx(4 hunks)surfsense_web/app/(home)/login/page.tsx(4 hunks)surfsense_web/app/(home)/register/page.tsx(10 hunks)surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx(5 hunks)surfsense_web/app/dashboard/[search_space_id]/connectors/(manage)/page.tsx(21 hunks)surfsense_web/app/dashboard/[search_space_id]/connectors/add/page.tsx(6 hunks)surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsFilters.tsx(3 hunks)surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx(8 hunks)surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/PaginationControls.tsx(2 hunks)surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/page.tsx(3 hunks)surfsense_web/app/dashboard/[search_space_id]/documents/upload/page.tsx(13 hunks)surfsense_web/app/dashboard/[search_space_id]/documents/webpage/page.tsx(8 hunks)surfsense_web/app/dashboard/[search_space_id]/documents/youtube/page.tsx(11 hunks)surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx(30 hunks)surfsense_web/app/dashboard/[search_space_id]/onboard/page.tsx(7 hunks)surfsense_web/app/dashboard/[search_space_id]/researcher/[[...chat_id]]/page.tsx(2 hunks)surfsense_web/app/dashboard/page.tsx(13 hunks)surfsense_web/app/layout.tsx(1 hunks)surfsense_web/components/LanguageSwitcher.tsx(1 hunks)surfsense_web/components/chat/ChatInputGroup.tsx(0 hunks)surfsense_web/components/chat/ChatInterface.tsx(0 hunks)surfsense_web/components/chat/ConnectorComponents.tsx(1 hunks)surfsense_web/components/chat/types.ts(1 hunks)surfsense_web/components/dashboard-breadcrumb.tsx(7 hunks)surfsense_web/components/homepage/footer-new.tsx(1 hunks)surfsense_web/components/onboard/add-provider-step.tsx(9 hunks)surfsense_web/components/onboard/assign-roles-step.tsx(8 hunks)surfsense_web/components/providers/I18nProvider.tsx(1 hunks)surfsense_web/components/sidebar/AppSidebarProvider.tsx(8 hunks)surfsense_web/components/sidebar/nav-main.tsx(2 hunks)surfsense_web/components/sidebar/nav-projects.tsx(5 hunks)surfsense_web/components/sidebar/nav-secondary.tsx(2 hunks)surfsense_web/contexts/LocaleContext.tsx(1 hunks)surfsense_web/i18n/request.ts(1 hunks)surfsense_web/i18n/routing.ts(1 hunks)surfsense_web/messages/en.json(1 hunks)surfsense_web/messages/zh.json(1 hunks)surfsense_web/middleware.ts(1 hunks)surfsense_web/next.config.ts(1 hunks)
💤 Files with no reviewable changes (15)
- surfsense_web/README.md
- surfsense_backend/app/agents/researcher/utils.py
- surfsense_backend/README.md
- surfsense_web/components/chat/ChatInterface.tsx
- surfsense_backend/app/db.py
- surfsense_backend/app/agents/researcher/sub_section_writer/nodes.py
- surfsense_backend/app/agents/researcher/configuration.py
- surfsense_backend/app/agents/researcher/sub_section_writer/prompts.py
- surfsense_backend/app/agents/researcher/sub_section_writer/init.py
- surfsense_backend/app/agents/researcher/sub_section_writer/state.py
- surfsense_backend/app/tasks/stream_connector_search_results.py
- surfsense_backend/app/agents/researcher/sub_section_writer/graph.py
- surfsense_backend/app/agents/researcher/sub_section_writer/configuration.py
- surfsense_backend/app/agents/researcher/state.py
- surfsense_web/components/chat/ChatInputGroup.tsx
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.rules/require_unique_id_props.mdc)
**/*.{jsx,tsx}: When mapping arrays to React elements in JSX/TSX, each rendered element must include a unique key prop
Keys used for React list items should be stable, predictable, and unique among siblings
Files:
surfsense_web/app/dashboard/page.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/PaginationControls.tsxsurfsense_web/app/dashboard/[search_space_id]/researcher/[[...chat_id]]/page.tsxsurfsense_web/app/(home)/login/GoogleLoginButton.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/upload/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/(manage)/page.tsxsurfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/(manage)/page.tsxsurfsense_web/components/sidebar/nav-secondary.tsxsurfsense_web/components/dashboard-breadcrumb.tsxsurfsense_web/components/providers/I18nProvider.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/webpage/page.tsxsurfsense_web/components/sidebar/AppSidebarProvider.tsxsurfsense_web/app/(home)/login/page.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsFilters.tsxsurfsense_web/app/(home)/register/page.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/youtube/page.tsxsurfsense_web/contexts/LocaleContext.tsxsurfsense_web/app/dashboard/[search_space_id]/client-layout.tsxsurfsense_web/components/LanguageSwitcher.tsxsurfsense_web/app/layout.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/page.tsxsurfsense_web/components/onboard/add-provider-step.tsxsurfsense_web/components/sidebar/nav-projects.tsxsurfsense_web/components/sidebar/nav-main.tsxsurfsense_web/components/onboard/assign-roles-step.tsxsurfsense_web/app/dashboard/[search_space_id]/onboard/page.tsxsurfsense_web/components/homepage/footer-new.tsxsurfsense_web/components/chat/ConnectorComponents.tsxsurfsense_web/app/(home)/login/LocalLoginForm.tsx
🧬 Code graph analysis (10)
surfsense_web/app/dashboard/page.tsx (4)
surfsense_web/components/ui/card.tsx (5)
CardTitle(55-55)CardDescription(55-55)CardHeader(55-55)CardContent(55-55)CardFooter(55-55)surfsense_web/components/ui/alert.tsx (3)
Alert(48-48)AlertTitle(48-48)AlertDescription(48-48)surfsense_web/components/ui/button.tsx (1)
Button(56-56)surfsense_web/components/ui/alert-dialog.tsx (6)
AlertDialogTitle(130-130)AlertDialogDescription(131-131)AlertDialogHeader(128-128)AlertDialogFooter(129-129)AlertDialogCancel(133-133)AlertDialogAction(132-132)
surfsense_web/i18n/request.ts (1)
surfsense_web/i18n/routing.ts (1)
routing(8-18)
surfsense_web/components/providers/I18nProvider.tsx (1)
surfsense_web/contexts/LocaleContext.tsx (1)
useLocaleContext(64-70)
surfsense_web/components/LanguageSwitcher.tsx (1)
surfsense_web/contexts/LocaleContext.tsx (1)
useLocaleContext(64-70)
surfsense_backend/app/agents/researcher/graph.py (4)
surfsense_backend/app/agents/researcher/configuration.py (1)
Configuration(19-38)surfsense_backend/app/agents/researcher/nodes.py (3)
generate_further_questions(1541-1735)handle_qna_workflow(1326-1538)reformulate_user_query(1300-1323)surfsense_backend/app/agents/researcher/state.py (1)
State(14-38)surfsense_backend/app/agents/researcher/qna_agent/state.py (1)
State(12-27)
surfsense_web/components/sidebar/nav-projects.tsx (1)
surfsense_web/components/ui/sidebar.tsx (2)
SidebarGroupLabel(672-672)SidebarInput(674-674)
surfsense_backend/app/agents/researcher/nodes.py (4)
surfsense_backend/app/agents/researcher/prompts.py (1)
get_further_questions_system_prompt(11-140)surfsense_backend/app/agents/researcher/state.py (1)
State(14-38)surfsense_backend/app/agents/researcher/qna_agent/state.py (1)
State(12-27)surfsense_backend/app/agents/researcher/utils.py (2)
get_connector_emoji(17-38)get_connector_friendly_name(41-63)
surfsense_web/components/onboard/assign-roles-step.tsx (1)
surfsense_web/hooks/use-llm-configs.ts (2)
useLLMConfigs(50-190)useLLMPreferences(192-285)
surfsense_web/app/dashboard/[search_space_id]/onboard/page.tsx (1)
surfsense_web/components/ui/card.tsx (2)
Card(55-55)CardContent(55-55)
surfsense_web/components/homepage/footer-new.tsx (1)
surfsense_web/components/Logo.tsx (1)
Logo(7-13)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Python Backend Quality
🔇 Additional comments (55)
surfsense_web/middleware.ts (1)
5-10: Formatting changes look good.The quote normalization and import adjustments are consistent with the project-wide standardization effort. No functional changes detected; middleware behavior remains unchanged.
surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/PaginationControls.tsx (2)
42-42: i18n string normalization applied correctly.The changes consistently update
useTranslationsand translation key access from single to double quotes, aligning with the PR's broader i18n refactoring objective. No functional impact.Also applies to: 55-55
62-66: React list keys are stable and unique.The
SelectItemelements correctly usekey={s}where each value in[5, 10, 25, 50]is stable, predictable, and unique among siblings. This complies with the coding guideline for React list rendering.surfsense_web/app/dashboard/[search_space_id]/documents/webpage/page.tsx (1)
6-6: LGTM! Consistent quote style standardization.The changes uniformly convert translation key lookups from single quotes to double quotes across the component. This improves code consistency without altering any functionality or logic.
Also applies to: 24-24, 43-43, 50-50, 58-59, 88-90, 95-97, 108-109, 116-117, 137-137, 139-139, 144-144, 149-149, 164-164, 170-170, 172-175, 185-185, 191-191, 194-194
surfsense_web/app/dashboard/[search_space_id]/connectors/add/page.tsx (1)
13-13: LGTM! Stylistic quote normalization.The translation key quoting has been consistently normalized from single to double quotes across all
t()calls. This is a non-functional change that aligns with the broader i18n style standardization mentioned in the PR summary.Also applies to: 242-242, 271-273, 344-344, 352-352, 360-362, 372-372, 390-390, 398-398
surfsense_web/components/homepage/footer-new.tsx (2)
1-10: Clean import organization.The consolidated icon imports and supporting library imports are well-structured and include all necessary dependencies.
13-90: Data structures well-organized.The page links, social media references, legal links, and signup options are cleanly structured and properly formatted.
surfsense_web/components/onboard/add-provider-step.tsx (1)
5-292: LGTM! Quote normalization improves consistency.The refactoring successfully standardizes translation key string literals from single to double quotes throughout the component, improving code consistency without affecting functionality. All React list mappings properly include unique key props as required by the coding guidelines.
surfsense_web/app/dashboard/[search_space_id]/documents/youtube/page.tsx (1)
8-286: LGTM! Consistent quote style improves maintainability.The translation key quote normalization from single to double quotes is purely cosmetic and improves consistency across the codebase. No functional changes introduced.
surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx (4)
6-9: LGTM! Clean import organization.The type import positioning and LanguageSwitcher addition are well-structured. The new language switcher component is properly imported and used in the header.
28-55: LGTM! Consistent i18n key quoting.The standardization from single to double quotes for translation keys improves consistency. The data transformations in
useMemoremain functionally correct.
101-121: LGTM! Translation keys normalized in UI screens.The loading and error screen translations have been consistently updated to use double-quoted keys, maintaining the same functionality.
148-148: LGTM! Language switcher well-positioned.The
LanguageSwitchercomponent is appropriately placed in the header alongside other controls like the theme toggler, providing good UX for language selection.surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx (1)
46-46: LGTM! Translation key normalization is consistent and well-executed.The refactoring systematically converts all translation keys to use double quotes, improving code consistency across the internationalization implementation. The changes are purely stylistic with no functional impact.
Also applies to: 199-199, 223-223, 249-249, 260-260, 267-267, 300-300, 315-315, 332-332, 465-466, 470-470, 495-495, 507-510, 514-515, 549-549, 577-577, 579-579, 598-598, 603-605, 614-614, 621-621, 630-630, 641-641, 651-651, 658-658, 680-680, 699-699, 722-722, 731-731, 743-743, 747-747, 819-821, 904-909, 1002-1007, 1030-1030, 1129-1129, 1133-1133, 1154-1154, 1168-1168, 1173-1174, 1177-1177, 1179-1179
surfsense_web/components/dashboard-breadcrumb.tsx (3)
5-5: LGTM! Consistent i18n key quoting normalization.The changes from single to double quotes for translation keys align with the broader repository-wide standardization effort. The multi-line formatting improvements enhance readability.
Also applies to: 21-21, 30-30, 34-37, 46-52, 65-67, 72-72, 114-115, 120-120, 129-134
25-151: LGTM! Good refactoring to extract breadcrumb generation logic.Extracting the
generateBreadcrumbsfunction improves modularity, testability, and maintainability. The logic is well-structured and easy to follow.
162-173: LGTM! React key usage is appropriate for this use case.While using
indexas a React key is generally discouraged, it's acceptable here because breadcrumbs are generated deterministically from the pathname and represent a stable, positional hierarchy that won't be dynamically reordered or filtered.As per coding guidelines.
surfsense_web/components/onboard/assign-roles-step.tsx (3)
26-26: LGTM! Quote style normalization improves consistency.The change from single to double quotes in the
useTranslationscall is a stylistic improvement that aligns with the broader normalization across this file.
30-52: LGTM! Consistent quote style across all translation calls.The normalization of all
t("...")calls within theROLE_DESCRIPTIONSobject to use double quotes improves readability and maintains consistency throughout the codebase.
110-219: LGTM! Quote normalization applied consistently across all UI elements.All translation calls have been properly updated to use double quotes. Additionally, React list rendering requirements are satisfied:
- Lines 130-208: Role cards properly keyed with
key={key}fromObject.entries()- Lines 174-186: Select items properly keyed with
key={config.id}The changes maintain functionality while improving code consistency.
surfsense_backend/app/utils/validators.py (1)
204-204: LGTM - Consistent with QNA-only refactor.The restriction to
["QNA"]aligns with the PR's objective of removing multi-mode research functionality. This change ensures backend validation enforces the simplified research mode.surfsense_web/components/chat/types.ts (1)
50-50: LGTM - Type narrowing is consistent with refactor.The
ResearchModetype now reflects the single supported mode. While technically redundant as a single-literal type, maintaining the type alias preserves API consistency and allows for easier future extensions.surfsense_web/app/dashboard/[search_space_id]/researcher/[[...chat_id]]/page.tsx (4)
53-53: LGTM - ResearchMode simplified to constant.The inline comment clearly documents that research mode is now fixed to "QNA". The type annotation ensures type safety.
133-133: LGTM - Correct handling of constant ResearchMode.The comment accurately reflects that restoration is unnecessary since
researchModeis now a constant.
136-136: LGTM - Dependency array correctly updated.Removing
setResearchModefrom the dependency array is appropriate since research mode is no longer mutable state.
144-144: LGTM - Correctly skips loading constant value.The comment appropriately documents that
researchModedoesn't need to be loaded from chat data since it's now a constant.surfsense_web/components/chat/ConnectorComponents.tsx (2)
10-26: LGTM - Well-structured utility components.The new
ConnectorIconandConnectorCountBadgecomponents are simple, focused, and properly typed. They enhance code reusability for the connector UI.
28-109: LGTM - Clean connector button implementation.The
ConnectorButtoncomponent effectively uses the new utility components and provides clear visual feedback about selected connectors and progress.surfsense_backend/app/agents/researcher/prompts.py (1)
5-5: LGTM - Documentation improvement.Adding a docstring to the helper function improves code maintainability and follows Python best practices.
surfsense_backend/app/agents/researcher/graph.py (2)
16-20: LGTM - Documentation matches simplified workflow.The updated docstring accurately describes the linear Q&A workflow, making the architectural simplification clear.
33-37: LGTM - Clean linear workflow implementation.The simplified graph structure eliminates conditional routing in favor of a straightforward linear flow. This reduces complexity and aligns with the QNA-only architecture.
surfsense_backend/app/agents/researcher/nodes.py (1)
1547-1547: LGTM - Terminology updated for accuracy.Changing "sub-agents" to "QNA agent" correctly reflects the simplified architecture where the QNA agent is the specific source of reranked documents.
surfsense_web/i18n/routing.ts (1)
1-2: Routing config is consistent and idiomatic.Locales, default, and prefix are correct; exported helpers align with next-intl usage.
Also applies to: 9-18, 22-22
surfsense_web/contexts/LocaleContext.tsx (1)
21-28: LGTM: client‑safe locale bootstrapping and lang updates.SSR-safe guards, initial "en" to avoid hydration mismatch, and
documentElement.langupdates are solid.Also applies to: 41-48, 51-55, 57-61
surfsense_web/components/sidebar/AppSidebarProvider.tsx (3)
197-233: Good i18n for fallbacks; ensure list rendering uses keys.Fallback chat entries use
t/tCommoncorrectly. Please confirmAppSidebarmapsdisplayChatswith stablekey={chat.id}per guidelines.
246-261: Nice: dynamic secondary nav title covers loading/error/unknown states.Good use of dashboard/common keys to reflect state in the sidebar.
278-283: Dialog copy is properly localized and consistent with messages.Delete title/description and buttons use the correct namespaces; no issues.
Also applies to: 291-303, 307-308
surfsense_web/next.config.ts (1)
3-7: Verification complete—file exists andnext-intl@^3.26.5supports the API.The
surfsense_web/i18n/request.tsfile exists, and next-intl version 3.26.5 supportscreateNextIntlPluginwith a custom path argument. The import and usage are correct per official documentation. Code is ready.surfsense_web/components/LanguageSwitcher.tsx (2)
44-51: Keys look goodStable, unique keys via language.code. LGTM.
21-25: Docstring claims localStorage persistence—verify source of truthThis component doesn’t write to localStorage. If LocaleContext persists for you, fine; otherwise update the comment or add persistence here.
Do you want me to wire a small useEffect to sync locale to localStorage?
surfsense_web/components/providers/I18nProvider.tsx (1)
14-16: LGTMProvider wiring with locale/messages from context looks correct.
surfsense_web/app/dashboard/[search_space_id]/connectors/(manage)/page.tsx (1)
164-165: Review comment is incorrect—no type consistency issue existsThe
indexConnectorfunction fromuse-search-source-connectorsexplicitly acceptssearchSpaceId: string | number(line 300 in use-search-source-connectors.ts). The code correctly passessearchSpaceIdas a string at lines 147 and 164, which is valid per the function signature. TheupdateConnectorcall at line 224 also correctly passes anumberto anumberparameter. No type mismatch occurs.Likely an incorrect or invalid review comment.
surfsense_web/app/layout.tsx (1)
5-9: LGTM - Import organization cleanup.The import reordering improves consistency without affecting functionality.
surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx (1)
6-6: LGTM - i18n quote standardization.The translation key usage has been consistently updated to use double quotes throughout the file. All functionality remains unchanged, and React keys are properly implemented for mapped arrays.
Also applies to: 70-70, 106-340
surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/page.tsx (1)
5-5: LGTM - Consistent i18n standardization.Import organization improved and translation keys standardized to double quotes with no functional impact.
Also applies to: 26-139
surfsense_web/app/(home)/login/GoogleLoginButton.tsx (1)
9-10: LGTM - i18n quote standardization.All translation keys consistently updated to use double quotes, aligning with project conventions.
Also applies to: 37-97
surfsense_web/components/sidebar/nav-secondary.tsx (1)
4-4: LGTM - Import and i18n standardization.The useTranslations import has been properly positioned, and translation keys standardized to double quotes.
Also applies to: 28-35
surfsense_web/app/dashboard/page.tsx (1)
8-8: LGTM - Comprehensive i18n standardization.Translation keys have been consistently updated to double quotes throughout the file. All functionality remains unchanged, and React keys are properly implemented for mapped arrays using
space.id.Also applies to: 65-395
surfsense_web/components/sidebar/nav-main.tsx (1)
5-5: LGTM - i18n standardization and import optimization.The translation key mapping and usage have been standardized to double quotes. The
useMemoimport addition and translation key structure updates maintain functionality while improving consistency.Also applies to: 32-61
surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsFilters.tsx (1)
6-6: LGTM - Import and i18n standardization.Import organization improved and translation keys consistently updated to double quotes. React keys are properly implemented for mapped arrays.
Also applies to: 59-97
surfsense_web/app/dashboard/[search_space_id]/documents/upload/page.tsx (1)
6-6: LGTM! Clean i18n standardization.The translation key updates from single to double quotes are consistent throughout the file, and the import consolidation is well done. All React list items maintain proper unique keys as required.
Also applies to: 43-43, 279-289, 335-548
surfsense_web/app/(home)/login/page.tsx (1)
6-6: LGTM! Consistent translation key standardization.All translation keys have been properly updated to use double quotes, maintaining consistency with the broader codebase refactor. The import consolidation is clean and the functionality remains unchanged.
Also applies to: 16-17, 32-43, 99-99, 116-116
surfsense_web/app/(home)/register/page.tsx (1)
6-6: LGTM! Thorough i18n standardization.The translation key updates are consistent throughout the registration flow. All error handling, validation logic, and user feedback mechanisms remain intact while adopting the double-quote standard.
Also applies to: 14-15, 37-51, 89-143, 215-292
surfsense_web/app/dashboard/[search_space_id]/onboard/page.tsx (1)
20-20: LGTM! Clean i18n updates with minor UI improvement.The translation keys are consistently updated to double quotes. The progress header layout change (lines 138-142) improves the visual separation between step counter and completion percentage, which is a nice touch. React list items maintain proper keys.
Also applies to: 72-78, 109-109, 128-142, 230-250
surfsense_web/app/(home)/login/LocalLoginForm.tsx (1)
6-6: LGTM! Well-structured form with consistent i18n.The translation keys are properly standardized to double quotes, and the form structure reorganization (lines 175-227) improves code clarity while preserving all functionality including the password visibility toggle and error handling.
Also applies to: 12-13, 35-35, 62-62, 175-251
Description
Removed sub_section_writer agent as its bad and confuses users
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR removes the
sub_section_writeragent and all report generation modes (REPORT_GENERAL, REPORT_DEEP, REPORT_DEEPER), simplifying the researcher functionality to only support Q&A mode. The backend eliminates complex multi-section report workflows, outline generation, and parallel section processing. The frontend removes research mode selection UI components and state management, along with unused README files. This is a breaking change that significantly reduces the feature set by removing the ability to generate structured reports.⏱️ Estimated Review Time: 1-3 hours
💡 Review Order Suggestion
surfsense_backend/app/utils/validators.pysurfsense_backend/app/db.pysurfsense_backend/app/agents/researcher/configuration.pysurfsense_backend/app/tasks/stream_connector_search_results.pysurfsense_backend/app/agents/researcher/graph.pysurfsense_backend/app/agents/researcher/state.pysurfsense_backend/app/agents/researcher/nodes.pysurfsense_backend/app/agents/researcher/prompts.pysurfsense_backend/app/agents/researcher/utils.pysurfsense_backend/app/agents/researcher/sub_section_writer/__init__.pysurfsense_backend/app/agents/researcher/sub_section_writer/configuration.pysurfsense_backend/app/agents/researcher/sub_section_writer/graph.pysurfsense_backend/app/agents/researcher/sub_section_writer/nodes.pysurfsense_backend/app/agents/researcher/sub_section_writer/prompts.pysurfsense_backend/app/agents/researcher/sub_section_writer/state.pysurfsense_web/components/chat/types.tssurfsense_web/components/chat/ConnectorComponents.tsxsurfsense_web/components/chat/ChatInputGroup.tsxsurfsense_web/components/chat/ChatInterface.tsxsurfsense_web/app/dashboard/[search_space_id]/researcher/[[...chat_id]]/page.tsxsurfsense_web/hooks/use-chat.tsxsurfsense_backend/README.mdsurfsense_web/README.mdSummary by CodeRabbit
Release Notes
New Features
Changes
Documentation