-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
base: main
Are you sure you want to change the base?
Deep Research UI #4887
Conversation
@drew-harris is attempting to deploy a commit to the Danswer Team on Vercel. A member of the Team first needs to authorize it. |
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.
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
andDeepActions
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
if ("collapsed" in action) { | ||
return true; | ||
} | ||
return false; |
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.
style: Simplify isCollapsible to a one-liner: return 'collapsed' in action
if ("collapsed" in action) { | |
return true; | |
} | |
return false; | |
return "collapsed" in action; |
yield buildActionPacket("run_command", { | ||
id: "parse-nike", | ||
cmd: `curl https://www.nike.com/`, | ||
result: longHtml, | ||
collapsed: false, | ||
}); |
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.
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
await delay(200); | ||
yield { | ||
answer_piece: word + " ", | ||
}; |
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.
style: Adding a space after each word creates extra trailing space in final result. Consider trimming or joining words with space instead
${ | ||
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" | ||
} |
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.
style: The enabled/disabled states have identical CSS classes. Redundant ternary that can be simplified to a single string.
${ | |
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 |
// @ts-ignore | ||
onClick={() => props!.handleFeedback("like")} | ||
/> |
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.
logic: Remove @ts-ignore
and properly type the props. This indicates a type mismatch that should be fixed rather than ignored.
interface DeepToggleProps { | ||
enabled: boolean; | ||
setEnabled: (enabled: boolean) => void; | ||
} |
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.
style: Props interface named 'DeepToggleProps' while component is 'DeepResearchToggle'. Consider renaming to 'DeepResearchToggleProps' for consistency.
{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 : ( | ||
<></> | ||
)} |
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.
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; |
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.
logic: useDeepResearch added to interface but not used in sendMessage function body. Add this to the request body in sendMessage to enable the feature.
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> { |
const messagePromise = params.useDeepResearch | ||
? mockSendMessage(params) | ||
: sendMessage(params); |
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.
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&cp=usns_aff_nike__PID_100481284_Afterpay+US+Inc&cjevent=44610f7447e711f082d100ae0a1cb827&_forward_params=1&pcn=cj_mobile_inactivity-0d&_smtype=3&psid=100481284&pcrn=CJ&cl=44610f7447e711f082d100ae0a1cb827&pcrid=17047842&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"};;/* |
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.
logic: Remove trailing ellipsis ('/*') at the end of the HTML string - it appears to be incomplete and could cause parsing issues
<!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&cp=usns_aff_nike__PID_100481284_Afterpay+US+Inc&cjevent=44610f7447e711f082d100ae0a1cb827&_forward_params=1&pcn=cj_mobile_inactivity-0d&_smtype=3&psid=100481284&pcrn=CJ&cl=44610f7447e711f082d100ae0a1cb827&pcrid=17047842&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&cp=usns_aff_nike__PID_100481284_Afterpay+US+Inc&cjevent=44610f7447e711f082d100ae0a1cb827&_forward_params=1&pcn=cj_mobile_inactivity-0d&_smtype=3&psid=100481284&pcrn=CJ&cl=44610f7447e711f082d100ae0a1cb827&pcrid=17047842&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> |
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.