|
189 | 189 | } |
190 | 190 | } |
191 | 191 |
|
| 192 | + function shouldRenderIcebreakerOnLocalChatHost() { |
| 193 | + try { |
| 194 | + var path = String((window.location && window.location.pathname) || ''); |
| 195 | + if (window.__NEKO_MULTI_WINDOW__ === true && !/^\/chat(?:\/|$)/.test(path)) { |
| 196 | + return false; |
| 197 | + } |
| 198 | + } catch (_) {} |
| 199 | + return true; |
| 200 | + } |
| 201 | + |
192 | 202 | function broadcastIcebreaker(action, payload) { |
193 | 203 | var message = Object.assign({ |
194 | 204 | action: action, |
|
288 | 298 | }; |
289 | 299 | broadcastIcebreakerAppendMessage(message); |
290 | 300 | appendLlmContext(role, messageText, meta || {}); |
| 301 | + if (!shouldRenderIcebreakerOnLocalChatHost()) { |
| 302 | + return Promise.resolve(message); |
| 303 | + } |
291 | 304 | return waitForChatHost(30000).then(function (host) { |
292 | 305 | if (typeof host.openWindow === 'function') { |
293 | 306 | host.openWindow(); |
|
372 | 385 | options: buildPromptOptions(node, localeData) |
373 | 386 | }; |
374 | 387 | broadcastIcebreakerChoicePrompt(prompt); |
| 388 | + if (!shouldRenderIcebreakerOnLocalChatHost()) { |
| 389 | + return Promise.resolve(false); |
| 390 | + } |
375 | 391 | return waitForChatHost(30000).then(function (host) { |
376 | 392 | if (!host || typeof host.setIcebreakerChoicePrompt !== 'function') return false; |
377 | 393 | host.setIcebreakerChoicePrompt(prompt); |
|
386 | 402 | if (!activeSession || !activeSession.sessionId) return; |
387 | 403 | var sessionId = activeSession.sessionId; |
388 | 404 | broadcastIcebreakerClearChoicePrompt(sessionId); |
| 405 | + if (!shouldRenderIcebreakerOnLocalChatHost()) return; |
389 | 406 | waitForChatHost(1200).then(function (host) { |
390 | 407 | if (host && typeof host.clearIcebreakerChoicePrompt === 'function') { |
391 | 408 | host.clearIcebreakerChoicePrompt(sessionId); |
|
0 commit comments