Skip to content

Deep Research UI #4887

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Conversation

drew-harris
Copy link

Description

[Provide a brief description of the changes in this PR]

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@drew-harris drew-harris requested a review from a team as a code owner June 13, 2025 01:16
Copy link

vercel bot commented Jun 13, 2025

@drew-harris is attempting to deploy a commit to the Danswer Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Implements a new Deep Research mode in the chat interface, adding advanced research capabilities with web search, command execution, and email functionality.

  • New Deep Research toggle added to web/src/app/chat/input/ChatInputBar.tsx with mutual exclusivity to pro search mode
  • Added DeepResearchMessage and DeepActions components in /web/src/app/chat for handling various research actions (web search, email, commands)
  • Introduced type-safe action handling system in deepResearchAction.ts for managing different research operations
  • Extended existing Message interface in interfaces.ts to track deep research state and actions
  • Testing implementation currently uses mock data (drewMock.ts, mockConstants.ts) for UI development

13 files reviewed, 13 comments
Edit PR Review Bot Settings | Greptile

Comment on lines +68 to +71
if ("collapsed" in action) {
return true;
}
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Simplify isCollapsible to a one-liner: return 'collapsed' in action

Suggested change
if ("collapsed" in action) {
return true;
}
return false;
return "collapsed" in action;

Comment on lines +91 to +96
yield buildActionPacket("run_command", {
id: "parse-nike",
cmd: `curl https://www.nike.com/`,
result: longHtml,
collapsed: false,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Duplicate call to parse-nike command with identical parameters. First call at line 75 returns empty result, this one returns longHtml. Inconsistent behavior may cause test flakiness

Comment on lines +127 to +130
await delay(200);
yield {
answer_piece: word + " ",
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Adding a space after each word creates extra trailing space in final result. Consider trimming or joining words with space instead

Comment on lines +34 to +38
${
enabled
? "border-background-200 group-hover:border-[#000] dark:group-hover:border-neutral-300"
: "border-background-200 group-hover:border-[#000] dark:group-hover:border-neutral-300"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: The enabled/disabled states have identical CSS classes. Redundant ternary that can be simplified to a single string.

Suggested change
${
enabled
? "border-background-200 group-hover:border-[#000] dark:group-hover:border-neutral-300"
: "border-background-200 group-hover:border-[#000] dark:group-hover:border-neutral-300"
}
border-background-200 group-hover:border-[#000] dark:group-hover:border-neutral-300

Comment on lines +196 to +198
// @ts-ignore
onClick={() => props!.handleFeedback("like")}
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Remove @ts-ignore and properly type the props. This indicates a type mismatch that should be fixed rather than ignored.

Comment on lines +9 to +12
interface DeepToggleProps {
enabled: boolean;
setEnabled: (enabled: boolean) => void;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Props interface named 'DeepToggleProps' while component is 'DeepResearchToggle'. Consider renaming to 'DeepResearchToggleProps' for consistency.

Comment on lines +150 to +162
{props.content ? (
<>
{typeof props.content === "string" ? (
<div className="overflow-x-visible max-w-content-max">
{props.content}
</div>
) : (
<div>{props.content}</div>
)}
</>
) : props.isComplete ? null : (
<></>
)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Simplify this nested ternary with multiple empty fragments into a cleaner conditional render

@@ -180,6 +182,7 @@ export interface SendMessageParams {
userFileIds?: number[];
userFolderIds?: number[];
useLanggraph?: boolean;
useDeepResearch?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: useDeepResearch added to interface but not used in sendMessage function body. Add this to the request body in sendMessage to enable the feature.

Suggested change
useDeepResearch?: boolean;
export async function* sendMessage({
regenerate,
message,
fileDescriptors,
userFileIds,
userFolderIds,
parentMessageId,
chatSessionId,
filters,
selectedDocumentIds,
queryOverride,
forceSearch,
modelProvider,
modelVersion,
temperature,
systemPromptOverride,
useExistingUserMessage,
alternateAssistantId,
signal,
useLanggraph,
useDeepResearch,
}: SendMessageParams): AsyncGenerator<PacketType, void, unknown> {

Comment on lines +1134 to +1136
const messagePromise = params.useDeepResearch
? mockSendMessage(params)
: sendMessage(params);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Make sure to remove mockSendMessage before merging to production

@@ -0,0 +1,3 @@
export const longHtml = `
<!DOCTYPE html><html lang="en-US"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0"/><meta name="keywords" content="nike"/><meta name="robots" content="index, follow"/><meta name="description" content="Nike delivers innovative products, experiences and services to inspire athletes."/><meta http-equiv="content-language" content="en-US"/><meta name="application-name" content="Nike.com"/><meta property="og:description" content="Nike delivers innovative products, experiences and services to inspire athletes."/><meta property="og:image" content="https://c.static-nike.com/a/images/w_1920,c_limit/bzl2wmsfh7kgdkufrrjq/image.jpg"/><meta property="og:locale" content="en-US"/><meta property="og:site_name" content="Nike.com"/><meta property="og:title" content="Nike. Just Do It"/><meta property="og:type" content="website"/><meta property="og:url" content="https://www.nike.com/?cid=4942550&amp;cp=usns_aff_nike__PID_100481284_Afterpay+US+Inc&amp;cjevent=44610f7447e711f082d100ae0a1cb827&amp;_forward_params=1&amp;pcn=cj_mobile_inactivity-0d&amp;_smtype=3&amp;psid=100481284&amp;pcrn=CJ&amp;cl=44610f7447e711f082d100ae0a1cb827&amp;pcrid=17047842&amp;psn=Afterpay+US+Inc"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:creator" content="@nike"/><meta name="twitter:description" content="Nike delivers innovative products, experiences and services to inspire athletes."/><meta name="twitter:image" content="https://c.static-nike.com/a/images/w_1920,c_limit/bzl2wmsfh7kgdkufrrjq/image.jpg"/><meta name="twitter:site" content="@nike"/><meta name="twitter:title" content="Nike. Just Do It"/><link href="https://www.nike.com/favicon.ico?v=1" rel="icon" type="image/x-icon"/><link href="https://www.nike.com/android-icon-192x192.png" rel="icon" sizes="192x192" type="image/png"/><link href="https://www.nike.com/android-icon-128x128.png" rel="icon" sizes="128x128" type="image/png"/><link href="https://www.nike.com/apple-touch-icon.png" rel="apple-touch-icon" type="image/png"/><link href="https://www.nike.com/apple-touch-icon-76x76-precomposed.png" rel="apple-touch-icon" sizes="76x76" type="image/png"/><link href="https://www.nike.com/apple-touch-icon-120x120-precomposed.png" rel="apple-touch-icon" sizes="120x120" type="image/png"/><link href="https://www.nike.com/apple-touch-icon-152x152-precomposed.png" rel="apple-touch-icon" sizes="152x152" type="image/png"/><link href="https://insights-collector.newrelic.com/" rel="dns-prefetch"/><link href="https://c.static-nike.com/" rel="dns-prefetch"/><link href="https://cdnjs.cloudflare.com/" rel="dns-prefetch"/><link href="https://secure-store.nike.com/" rel="dns-prefetch"/><link href="https://web.nike.com/" rel="dns-prefetch"/><link href="https://static.nike.com/" rel="dns-prefetch"/><link href="https://api.segment.io/" rel="dns-prefetch"/><link href="https://api.nike.com" rel="dns-prefetch"/><link href="https://connect.facebook.net/" rel="dns-prefetch"/><link href="https://analytics.nike.com/" rel="dns-prefetch"/><link as="font" crossorigin="crossorigin" href="https://www.nike.com/static/ncss/5.0/dotcom/fonts/Nike-Futura.woff2" rel="preload" type="font/woff2"/><link href="https://www.nike.com/" rel="canonical"/><title>Nike. Just Do It. Nike.com</title><meta name="next-head-count" content="40"/><script id="new-relic-browser-agent" type="text/javascript">window.NREUM||(NREUM={});NREUM.info = {"agent":"","beacon":"bam.nr-data.net","errorBeacon":"bam.nr-data.net","licenseKey":"NRBR-d074912dd348988f83d","applicationID":"175756206","agentToken":null,"applicationTime":151.116167,"transactionName":"ZVdXbUtXXBIHVUNfXlwde1ZLW1MND0xSUmRAWxoT","queueTime":0,"ttGuid":"5f1693e395762bf5"}; (window.NREUM||(NREUM={})).init={privacy:{cookies_enabled:true},ajax:{deny_list:["bam.nr-data.net"]}};(window.NREUM||(NREUM={})).loader_config={xpid:"UwcDVlVUGwIHUVZXAQMHUA==",licenseKey:"NRBR-d074912dd348988f83d",applicationID:"175756206"};;/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Remove trailing ellipsis ('/*') at the end of the HTML string - it appears to be incomplete and could cause parsing issues

Suggested change
<!DOCTYPE html><html lang="en-US"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0"/><meta name="keywords" content="nike"/><meta name="robots" content="index, follow"/><meta name="description" content="Nike delivers innovative products, experiences and services to inspire athletes."/><meta http-equiv="content-language" content="en-US"/><meta name="application-name" content="Nike.com"/><meta property="og:description" content="Nike delivers innovative products, experiences and services to inspire athletes."/><meta property="og:image" content="https://c.static-nike.com/a/images/w_1920,c_limit/bzl2wmsfh7kgdkufrrjq/image.jpg"/><meta property="og:locale" content="en-US"/><meta property="og:site_name" content="Nike.com"/><meta property="og:title" content="Nike. Just Do It"/><meta property="og:type" content="website"/><meta property="og:url" content="https://www.nike.com/?cid=4942550&amp;cp=usns_aff_nike__PID_100481284_Afterpay+US+Inc&amp;cjevent=44610f7447e711f082d100ae0a1cb827&amp;_forward_params=1&amp;pcn=cj_mobile_inactivity-0d&amp;_smtype=3&amp;psid=100481284&amp;pcrn=CJ&amp;cl=44610f7447e711f082d100ae0a1cb827&amp;pcrid=17047842&amp;psn=Afterpay+US+Inc"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:creator" content="@nike"/><meta name="twitter:description" content="Nike delivers innovative products, experiences and services to inspire athletes."/><meta name="twitter:image" content="https://c.static-nike.com/a/images/w_1920,c_limit/bzl2wmsfh7kgdkufrrjq/image.jpg"/><meta name="twitter:site" content="@nike"/><meta name="twitter:title" content="Nike. Just Do It"/><link href="https://www.nike.com/favicon.ico?v=1" rel="icon" type="image/x-icon"/><link href="https://www.nike.com/android-icon-192x192.png" rel="icon" sizes="192x192" type="image/png"/><link href="https://www.nike.com/android-icon-128x128.png" rel="icon" sizes="128x128" type="image/png"/><link href="https://www.nike.com/apple-touch-icon.png" rel="apple-touch-icon" type="image/png"/><link href="https://www.nike.com/apple-touch-icon-76x76-precomposed.png" rel="apple-touch-icon" sizes="76x76" type="image/png"/><link href="https://www.nike.com/apple-touch-icon-120x120-precomposed.png" rel="apple-touch-icon" sizes="120x120" type="image/png"/><link href="https://www.nike.com/apple-touch-icon-152x152-precomposed.png" rel="apple-touch-icon" sizes="152x152" type="image/png"/><link href="https://insights-collector.newrelic.com/" rel="dns-prefetch"/><link href="https://c.static-nike.com/" rel="dns-prefetch"/><link href="https://cdnjs.cloudflare.com/" rel="dns-prefetch"/><link href="https://secure-store.nike.com/" rel="dns-prefetch"/><link href="https://web.nike.com/" rel="dns-prefetch"/><link href="https://static.nike.com/" rel="dns-prefetch"/><link href="https://api.segment.io/" rel="dns-prefetch"/><link href="https://api.nike.com" rel="dns-prefetch"/><link href="https://connect.facebook.net/" rel="dns-prefetch"/><link href="https://analytics.nike.com/" rel="dns-prefetch"/><link as="font" crossorigin="crossorigin" href="https://www.nike.com/static/ncss/5.0/dotcom/fonts/Nike-Futura.woff2" rel="preload" type="font/woff2"/><link href="https://www.nike.com/" rel="canonical"/><title>Nike. Just Do It. Nike.com</title><meta name="next-head-count" content="40"/><script id="new-relic-browser-agent" type="text/javascript">window.NREUM||(NREUM={});NREUM.info = {"agent":"","beacon":"bam.nr-data.net","errorBeacon":"bam.nr-data.net","licenseKey":"NRBR-d074912dd348988f83d","applicationID":"175756206","agentToken":null,"applicationTime":151.116167,"transactionName":"ZVdXbUtXXBIHVUNfXlwde1ZLW1MND0xSUmRAWxoT","queueTime":0,"ttGuid":"5f1693e395762bf5"}; (window.NREUM||(NREUM={})).init={privacy:{cookies_enabled:true},ajax:{deny_list:["bam.nr-data.net"]}};(window.NREUM||(NREUM={})).loader_config={xpid:"UwcDVlVUGwIHUVZXAQMHUA==",licenseKey:"NRBR-d074912dd348988f83d",applicationID:"175756206"};;/*
<!DOCTYPE html><html lang="en-US"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0"/><meta name="keywords" content="nike"/><meta name="robots" content="index, follow"/><meta name="description" content="Nike delivers innovative products, experiences and services to inspire athletes."/><meta http-equiv="content-language" content="en-US"/><meta name="application-name" content="Nike.com"/><meta property="og:description" content="Nike delivers innovative products, experiences and services to inspire athletes."/><meta property="og:image" content="https://c.static-nike.com/a/images/w_1920,c_limit/bzl2wmsfh7kgdkufrrjq/image.jpg"/><meta property="og:locale" content="en-US"/><meta property="og:site_name" content="Nike.com"/><meta property="og:title" content="Nike. Just Do It"/><meta property="og:type" content="website"/><meta property="og:url" content="https://www.nike.com/?cid=4942550&amp;cp=usns_aff_nike__PID_100481284_Afterpay+US+Inc&amp;cjevent=44610f7447e711f082d100ae0a1cb827&amp;_forward_params=1&amp;pcn=cj_mobile_inactivity-0d&amp;_smtype=3&amp;psid=100481284&amp;pcrn=CJ&amp;cl=44610f7447e711f082d100ae0a1cb827&amp;pcrid=17047842&amp;psn=Afterpay+US+Inc"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:creator" content="`@nike`"/><meta name="twitter:description" content="Nike delivers innovative products, experiences and services to inspire athletes."/><meta name="twitter:image" content="https://c.static-nike.com/a/images/w_1920,c_limit/bzl2wmsfh7kgdkufrrjq/image.jpg"/><meta name="twitter:site" content="`@nike`"/><meta name="twitter:title" content="Nike. Just Do It"/><link href="https://www.nike.com/favicon.ico?v=1" rel="icon" type="image/x-icon"/><link href="https://www.nike.com/android-icon-192x192.png" rel="icon" sizes="192x192" type="image/png"/><link href="https://www.nike.com/android-icon-128x128.png" rel="icon" sizes="128x128" type="image/png"/><link href="https://www.nike.com/apple-touch-icon.png" rel="apple-touch-icon" type="image/png"/><link href="https://www.nike.com/apple-touch-icon-76x76-precomposed.png" rel="apple-touch-icon" sizes="76x76" type="image/png"/><link href="https://www.nike.com/apple-touch-icon-120x120-precomposed.png" rel="apple-touch-icon" sizes="120x120" type="image/png"/><link href="https://www.nike.com/apple-touch-icon-152x152-precomposed.png" rel="apple-touch-icon" sizes="152x152" type="image/png"/><link href="https://insights-collector.newrelic.com/" rel="dns-prefetch"/><link href="https://c.static-nike.com/" rel="dns-prefetch"/><link href="https://cdnjs.cloudflare.com/" rel="dns-prefetch"/><link href="https://secure-store.nike.com/" rel="dns-prefetch"/><link href="https://web.nike.com/" rel="dns-prefetch"/><link href="https://static.nike.com/" rel="dns-prefetch"/><link href="https://api.segment.io/" rel="dns-prefetch"/><link href="https://api.nike.com" rel="dns-prefetch"/><link href="https://connect.facebook.net/" rel="dns-prefetch"/><link href="https://analytics.nike.com/" rel="dns-prefetch"/><link as="font" crossorigin="crossorigin" href="https://www.nike.com/static/ncss/5.0/dotcom/fonts/Nike-Futura.woff2" rel="preload" type="font/woff2"/><link href="https://www.nike.com/" rel="canonical"/><title>Nike. Just Do It. Nike.com</title><meta name="next-head-count" content="40"/><script id="new-relic-browser-agent" type="text/javascript">window.NREUM||(NREUM={});NREUM.info = {"agent":"","beacon":"bam.nr-data.net","errorBeacon":"bam.nr-data.net","licenseKey":"NRBR-d074912dd348988f83d","applicationID":"175756206","agentToken":null,"applicationTime":151.116167,"transactionName":"ZVdXbUtXXBIHVUNfXlwde1ZLW1MND0xSUmRAWxoT","queueTime":0,"ttGuid":"5f1693e395762bf5"}; (window.NREUM||(NREUM={})).init={privacy:{cookies_enabled:true},ajax:{deny_list:["bam.nr-data.net"]}};(window.NREUM||(NREUM={})).loader_config={xpid:"UwcDVlVUGwIHUVZXAQMHUA==",licenseKey:"NRBR-d074912dd348988f83d",applicationID:"175756206"}};</script></head></html>

@drew-harris drew-harris marked this pull request as draft June 13, 2025 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant