This is an HTML preview example.
+ + +\`\`\``; + +export const MARKDOWN_CORPUS = `# Heading 1 +## Heading 2 +### Heading 3 + +A paragraph with **bold**, _italic_, ~~strikethrough~~, \`inline code\` and a [link](https://www.uipath.com). + +> A blockquote that spans a couple of lines to check wrapping and the quote rule. + +1. Ordered item +2. Another item + - Nested bullet + - Another nested bullet + +| Column | Value | +| --- | --- | +| Robots | 12 | +| Queues | 3 | + +Inline math such as $$E = mc^2$$ and a block: + +$$ +\\int_0^1 x^2 \\, dx = \\frac{1}{3} +$$ + + + +--- + +Footnote reference[^1]. + +[^1]: The footnote text.`; + +export const RESPONSE_ACTIONS: AutopilotChatMessageAction[] = [ + { + name: 'copy-action', + label: 'Copy to Clipboard', + icon: 'content_copy', + eventName: 'copy-custom', + }, + { + name: 'regenerate-action', + label: 'Regenerate', + icon: 'refresh', + eventName: 'regenerate-custom', + }, +]; + +export const CITATION_RESPONSE = { + content: + 'According to research, the sky is blue due to Rayleigh scattering. See references below for more information.', + widget: 'default', + contentParts: [ + { + text: 'According to research, the sky is blue due to Rayleigh scattering. ', + citations: [{ id: 1, title: 'Why is the Sky Blue?', url: 'https://example.com/sky' }], + }, + { + text: 'See references below for more information.', + citations: [{ id: 2, title: 'Atmospheric Science', url: 'https://example.com/atmosphere' }], + }, + ], +} satisfies Partial+ {footerDisclaimer} +
+ )} +This is an HTML preview example.
- - -\`\`\``; - chatService?.sendResponse({ - content: `Here's an HTML example with live preview:\n\n${htmlContent}`, + content: HTML_PREVIEW_MESSAGE, widget: 'default', - // biome-ignore lint/suspicious/noExplicitAny: widget property not properly typed - } as any); + created_at: '22-10-2025', + }); }; // Loading and error states @@ -1312,23 +833,7 @@ console.log(processUserData(exampleUser, { source: 'web', ipAddress: '192.168.1. }; const addHistoryItems = () => { - chatService?.setHistory([ - { - id: '1', - name: 'Previous Conversation 1', - timestamp: new Date(Date.now() - 86400000).toISOString(), - }, - { - id: '2', - name: 'Previous Conversation 2', - timestamp: new Date(Date.now() - 172800000).toISOString(), - }, - { - id: '3', - name: 'Previous Conversation 3', - timestamp: new Date(Date.now() - 259200000).toISOString(), - }, - ]); + chatService?.setHistory(storyHistoryItems()); }; // Utility @@ -1374,176 +879,24 @@ console.log(processUserData(exampleUser, { source: 'web', ipAddress: '192.168.1. }; const setFirstRunExperience = () => { - chatService?.setFirstRunExperience({ - title: 'Welcome to UiPath Autopilot', - description: - "I'm here to help you build, understand, and troubleshoot your automation projects.", - suggestions: [ - { - label: 'New process', - prompt: - 'Can you provide a detailed step-by-step guide on how to create a new automation process?', - }, - { - label: 'Debug workflow', - prompt: - "I'm having trouble with my workflow execution. Can you explain debugging techniques?", - }, - { - label: 'Studio updates', - prompt: 'What are the latest features in UiPath Studio?', - }, - ], - }); + chatService?.setFirstRunExperience(STORY_FIRST_RUN_EXPERIENCE); }; const setConversation = () => { - chatService?.setConversation([ - { - id: '1', - role: AutopilotChatRole.User, - content: 'How do I create a workflow that extracts data from invoices?', - created_at: '22-10-2022', - widget: '', - }, - { - id: '2', - role: AutopilotChatRole.Assistant, - content: - 'To extract data from invoices, you can use UiPath Document Understanding. Here\'s a step-by-step approach:\n\n1. Install the Document Understanding package\n2. Create a new workflow and add the "Digitize Document" activity\n3. Configure it to use ML skills\n4. Use the "Data Extraction" activity\n5. Validate the extracted data', - created_at: '23-10-2022', - widget: '', - }, - ]); + chatService?.setConversation(SAMPLE_CONVERSATION); }; const setSuggestions = () => { - chatService?.setSuggestions( - [ - { label: 'What can you do?', prompt: 'What can you do?' }, - { label: 'Show me an example', prompt: 'Show me an example' }, - { label: 'Help me with code', prompt: 'Help me with code' }, - ], - true - ); + chatService?.setSuggestions(STORY_SUGGESTIONS, true); }; - const sendToolCall = (displayMode: string) => { - const now = new Date().toISOString(); - const start = new Date(Date.now() - 2500).toISOString(); - - if (displayMode === ConversationalDisplayModeTypes.FullTrace) { - chatService?.sendResponse({ - content: 'Tool call response', - widget: 'apollo-agents-tool-call', - meta: { - displayMode, - span: { - key: 'multi-web-search', - name: 'Tool call - Multi_Web_Search', - data: { - id: 'root-span', - name: 'Tool call - Multi_Web_Search', - startTime: new Date(Date.now() - 25000).toISOString(), - endTime: now, - status: 'ok', - type: 'toolCall', - attributes: { - toolName: 'Multi_Web_Search', - toolType: 'Agent', - arguments: { query: 'what are trending right now' }, - result: { result: 'Multi web search completed successfully.' }, - }, - }, - children: [ - { - key: 'autonomous-web-search', - name: 'Autonomous Web Search', - data: { - id: 'agentTool-1', - name: 'Autonomous Web Search', - startTime: new Date(Date.now() - 25000).toISOString(), - endTime: now, - status: 'ok', - type: 'agentTool', - }, - children: [ - { - key: 'agent-run-1', - name: 'Agent run - Autonomous Web Search', - data: { - id: 'agentRun-1', - name: 'Agent run - Autonomous Web Search', - startTime: new Date(Date.now() - 23000).toISOString(), - endTime: now, - status: 'ok', - type: 'agentRun', - }, - children: [ - { - key: 'tool-call-web-search-1', - name: 'Tool call - Web_Search', - data: { - id: 'ws1', - name: 'Tool call - Web_Search', - type: 'toolCall', - status: 'ok', - startTime: new Date(Date.now() - 21000).toISOString(), - endTime: new Date(Date.now() - 17000).toISOString(), - }, - children: [], - }, - { - key: 'tool-call-web-search-2', - name: 'Tool call - Web_Search', - data: { - id: 'ws2', - name: 'Tool call - Web_Search', - type: 'toolCall', - status: 'ok', - startTime: new Date(Date.now() - 16000).toISOString(), - endTime: new Date(Date.now() - 10000).toISOString(), - }, - children: [], - }, - ], - }, - ], - }, - ], - }, - }, - // biome-ignore lint/suspicious/noExplicitAny: meta property not in public type definition - } as any); - return; - } - + const sendToolCall = (displayMode: StoryToolCallDisplayMode) => { chatService?.sendResponse({ content: 'Tool call response', widget: 'apollo-agents-tool-call', - meta: { - displayMode, - input: { - provider: 'GoogleCustomSearch', - query: 'most interesting scientific fact discovered recently 2025', - num: 5, - }, - output: { - results: [ - { - snippet: 'Breaking science news and articles...', - title: 'ScienceDaily: Latest Research News', - url: 'https://www.sciencedaily.com/', - }, - ], - }, - isError: false, - startTime: start, - endTime: now, - toolName: 'Web_Search', - }, - // biome-ignore lint/suspicious/noExplicitAny: meta property not in public type definition - } as any); + created_at: new Date().toISOString(), + meta: storyToolCallMeta(displayMode), + }); }; const sendResponseDisabledActions = () => { @@ -1574,98 +927,7 @@ console.log(processUserData(exampleUser, { source: 'web', ipAddress: '192.168.1. // Custom Header Actions const setCustomHeaderActions = () => { - chatService?.setCustomHeaderActions([ - { - id: 'export', - name: 'Export', - icon: 'download', - description: 'Export conversation in various formats', - children: [ - { - id: 'export-pdf', - name: 'Export as PDF', - icon: 'picture_as_pdf', - description: 'Download conversation as PDF file', - }, - { - id: 'export-docx', - name: 'Export as DOCX', - icon: 'description', - description: 'Download conversation as Word document', - }, - { - id: 'export-json', - name: 'Export as JSON', - icon: 'data_object', - description: 'Download conversation as JSON file', - }, - { - id: 'export-txt', - name: 'Export as Text', - icon: 'text_snippet', - description: 'Download conversation as plain text', - }, - ], - }, - { - id: 'share', - name: 'Share Conversation', - icon: 'share', - description: 'Share this conversation with others', - }, - { - id: 'translate', - name: 'Translate', - icon: 'translate', - description: 'Translate conversation to different languages', - children: [ - { - id: 'translate-es', - name: 'Spanish', - icon: 'language', - description: 'Translate to Spanish', - }, - { - id: 'translate-fr', - name: 'French', - icon: 'language', - description: 'Translate to French', - }, - { - id: 'translate-de', - name: 'German', - icon: 'language', - description: 'Translate to German', - }, - { - id: 'translate-ja', - name: 'Japanese', - icon: 'language', - description: 'Translate to Japanese', - }, - { - id: 'translate-zh', - name: 'Chinese', - icon: 'language', - description: 'Translate to Chinese', - }, - ], - }, - { - id: 'print', - name: 'Print', - icon: 'print', - description: 'Print conversation', - }, - { - id: 'advanced', - name: 'Advanced Settings', - icon: 'tune', - description: 'Advanced configuration options', - disabled: true, - }, - // biome-ignore lint/suspicious/noExplicitAny: Custom header actions type not fully defined - ] as any); + chatService?.setCustomHeaderActions(MATERIAL_CUSTOM_HEADER_ACTIONS); console.log('Custom header actions set'); }; @@ -1698,7 +960,7 @@ console.log(processUserData(exampleUser, { source: 'web', ipAddress: '192.168.1. const sendResponseWithVariables = () => { chatService?.sendResponse({ - content: `I will update [[resource-token:{"id":"var-email","type":"variable","icon":"mail","displayName":"email"}]] and [[resource-token:{"id":"var-long","type":"variable","icon":"data_object","displayName":"this_is_a_very_long_variable_name_that_should_test_truncation"}]] in the system, then notify [[resource-token:{"id":"var-username","type":"variable","icon":"person","displayName":"username"}]] when complete.`, + content: RESOURCE_TOKEN_MESSAGE, created_at: '02-02-2026', widget: 'default', }); @@ -1710,29 +972,7 @@ console.log(processUserData(exampleUser, { source: 'web', ipAddress: '192.168.1. const messageId = `streaming-resources-${Date.now()}`; let chunkIndex = 0; - const chunks = [ - 'I will update the ', - '[[resource-token:', // Start of token (incomplete) - '{"id":"var-', // JSON starts (still incomplete) - 'email","type":"variable",', // More JSON - '"icon":"mail","displayName":"email"}]]', // Token completes - ' variable in the system.\n\n', - "Then I'll notify ", - '[[resource-token:{', // Another token starts - '"id":"var-username",', - '"type":"variable","icon":"person",', - '"displayName":"username"}]]', // Token completes - ' when the process is complete.\n\n', - "I'll also update ", - '[[resource-token:{', - '"id":"var-long","type":"variable",', - '"icon":"data_object","displayName":', - '"this_is_a_very_long_variable_name_that_should_test_truncation"}]]', // Long label token - ' for testing.\n\n', - "Finally, I'll log the result to ", - '[[resource-token:{"id":"var-log","type":"variable","icon":"description","displayName":"activity_log"}]]', // Complete token in one chunk - '.', - ]; + const chunks = RESOURCE_TOKEN_CHUNKS; const streamChunk = () => { if (chunkIndex >= chunks.length) { @@ -1774,108 +1014,7 @@ console.log(processUserData(exampleUser, { source: 'web', ipAddress: '192.168.1. const messageId = `streaming-citations-${Date.now()}`; let streamIndex = 0; - const streamingParts = [ - { index: 0, text: 'Based on the search results' }, - { index: 0, text: ", I'll" }, - { index: 0, text: ' create a comprehensive' }, - { index: 0, text: ' summary about UiPath with' }, - { index: 0, text: ' citations:\n\n##' }, - { index: 0, text: ' Company Background' }, - { index: 0, text: '\n- ' }, - { index: 1, text: '**UiPath Inc**' }, - { index: 1, text: '. is a global' }, - { index: 1, text: ' software company that was' }, - { index: 1, text: ' founded in ' }, - { index: 1, text: '_Bucharest, Romania_' }, - { index: 1, text: ', by' }, - { index: 1, text: ' **Daniel Dines**' }, - { - index: 1, - text: '', - citation: { - id: 1, - title: 'UiPath - Wikipedia', - url: 'https://en.wikipedia.org/wiki/UiPath', - }, - }, - { index: 2, text: '. ' }, - { index: 3, text: 'The' }, - { index: 3, text: ' company starte' }, - { index: 3, text: 'd its journey' }, - { index: 3, text: ' in 2005' }, - { index: 3, text: ' and has' }, - { index: 3, text: ' grown to become a leading' }, - { index: 3, text: ' enterprise automation software ven' }, - { - index: 3, - text: 'dor', - citation: { - id: 1, - title: 'UiPath - Wikipedia', - url: 'https://en.wikipedia.org/wiki/UiPath', - }, - }, - { - index: 3, - text: '', - citation: { - id: 2, - title: 'UiPath, Inc. (PATH)', - url: 'https://ir.uipath.com/', - }, - }, - { index: 4, text: '. \n\n## Core' }, - { index: 4, text: ' Business' }, - { index: 4, text: '\nU' }, - { index: 4, text: 'iPath special' }, - { index: 4, text: 'izes in several' }, - { index: 4, text: ' key areas:\n\n1' }, - { index: 4, text: '. **Rob' }, - { index: 4, text: 'otic Process Automation' }, - { index: 4, text: ':**' }, - { index: 4, text: '\n' }, - { index: 5, text: 'R' }, - { index: 5, text: 'PA has' }, - { index: 5, text: ' revolutionized how work' }, - { index: 5, text: ' gets done globally' }, - { index: 5, text: ' by eliminating time' }, - { index: 5, text: '-consuming, repet' }, - { index: 5, text: 'itive tasks from employees' }, - { index: 5, text: "' worklo" }, - { - index: 5, - text: 'ads', - citation: { - id: 3, - title: 'Discovery Phase Guide', - download_url: 'https://ontheline.trincoll.edu/images/bookdown/sample-local-pdf.pdf', - page_number: 2, - }, - }, - { index: 6, text: '.' }, - { index: 6, text: '\n\n2. **' }, - { index: 6, text: 'Business Automation Platform**' }, - { index: 6, text: '\n' }, - { index: 7, text: 'The platform' }, - { index: 7, text: ' offers en' }, - { index: 7, text: 'd-to-en' }, - { index: 7, text: 'd process transformation' }, - { index: 7, text: ' capabilities on' }, - { index: 7, text: ' a single platform,' }, - { index: 7, text: ' featuring fully' }, - { index: 7, text: ' governed agentic' }, - { index: 7, text: ' automation that integ' }, - { index: 7, text: 'rates with existing systems' }, - { - index: 7, - text: '', - citation: { - id: 4, - title: 'UiPath Business Automation Platform | UiPath', - url: 'https://www.uipath.com/product', - }, - }, - ]; + const streamingParts = STREAMED_CITATION_CHUNKS; const streamChunk = () => { if (streamIndex >= streamingParts.length) { @@ -2430,20 +1569,11 @@ console.log(processUserData(exampleUser, { source: 'web', ipAddress: '192.168.1.