Skip to content

Commit f575d2f

Browse files
committed
trigger chatmode for example one
1 parent 189425e commit f575d2f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/background/handlers/ExecutionHandler.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,16 @@ export class ExecutionHandler {
289289
message: any,
290290
sendResponse: (response: any) => void
291291
): Promise<void> {
292-
const { tabId, query, metadata } = message
292+
const { tabId, query, chatMode, metadata } = message
293293

294294
Logging.log('ExecutionHandler',
295-
`Received query from newtab for tab ${tabId}: "${query}"`)
295+
`Received query from newtab for tab ${tabId}: "${query}" (mode: ${chatMode ? 'chat' : 'browse'})`)
296296

297297
// Log metrics
298298
Logging.logMetric('query_initiated', {
299299
query,
300300
source: metadata?.source || 'newtab',
301-
mode: 'browse',
301+
mode: chatMode ? 'chat' : 'browse',
302302
executionMode: metadata?.executionMode || 'dynamic',
303303
})
304304

@@ -312,7 +312,8 @@ export class ExecutionHandler {
312312
// Notify sidepanel that execution is starting (for processing state)
313313
chrome.runtime.sendMessage({
314314
type: MessageType.EXECUTION_STARTING,
315-
source: 'newtab'
315+
source: 'newtab',
316+
mode: chatMode ? 'chat' : 'browse'
316317
}).catch(() => {
317318
// Sidepanel might not be ready yet, that's OK - it will pick up state from stream
318319
})
@@ -325,7 +326,7 @@ export class ExecutionHandler {
325326

326327
// Update execution options
327328
this.execution.updateOptions({
328-
mode: 'browse',
329+
mode: chatMode ? 'chat' : 'browse',
329330
tabIds: [tabId],
330331
metadata,
331332
debug: false

src/onboarding/components/StepThree.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,14 @@ export function StepThree() {
114114
// Wait for the tab to load
115115
await new Promise(resolve => setTimeout(resolve, 1500))
116116

117+
// Determine if this should be chat mode or browse mode
118+
const chatMode = example.id === 'chat-mode'
119+
117120
await chrome.runtime.sendMessage({
118121
type: 'NEWTAB_EXECUTE_QUERY',
119122
tabId: newTab.id,
120123
query: example.query,
124+
chatMode: chatMode,
121125
metadata: {
122126
source: 'onboarding',
123127
executionMode: 'dynamic'

0 commit comments

Comments
 (0)