ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.
Python ai-agentsamdcomfyuidockerllama-cppllmlocal-ain8nnvidiaopen-webuiragself-hostedspeech-to-textstrix-halotext-to-speechworkflow-automation
fix(dashboard): keep ordered-list start numbers in Portal replies (#8178)
Mike Bradley00d8002d389c
diff --git a/ods/extensions/services/dashboard/src/pages/ODSTalk.jsx b/ods/extensions/services/dashboard/src/pages/ODSTalk.jsxindex 68c88bd5b..8418604bf 100644--- a/ods/extensions/services/dashboard/src/pages/ODSTalk.jsx+++ b/ods/extensions/services/dashboard/src/pages/ODSTalk.jsx@@ -13,7 +13,9 @@ import HelpLink from '../components/HelpLink'const MARKDOWN_COMPONENTS = {p: ({ children }) => <p className="break-words [&:not(:first-child)]:mt-3">{children}</p>,ul: ({ children }) => <ul className="my-2 list-disc space-y-1 pl-5">{children}</ul>,- ol: ({ children }) => <ol className="my-2 list-decimal space-y-1 pl-5">{children}</ol>,+ // Keep the list's start number: a reply of exactly "144." is a list that+ // starts at 144 with an empty item, and dropping it showed a bare "1.".+ ol: ({ children, start }) => <ol start={start} className="my-2 list-decimal space-y-1 pl-5">{children}</ol>,li: ({ children }) => <li className="break-words">{children}</li>,strong: ({ children }) => <strong className="font-semibold">{children}</strong>,em: ({ children }) => <em className="italic">{children}</em>,diff --git a/ods/extensions/services/dashboard/src/pages/ODSTalk.test.jsx b/ods/extensions/services/dashboard/src/pages/ODSTalk.test.jsxindex 7facc0938..fa8400d5d 100644--- a/ods/extensions/services/dashboard/src/pages/ODSTalk.test.jsx+++ b/ods/extensions/services/dashboard/src/pages/ODSTalk.test.jsx@@ -457,6 +457,36 @@ describe('ODSTalk', () => {expect(container.textContent).not.toContain('**')})+ test.each([+ ['what is 12 squared?', '144.', '144', ['']],+ ['what is left?', 'Steps 1 and 2 are done.\n\n3. Run the tests\n4. Open the pull request', '3', ['Run the tests', 'Open the pull request']],+ ])('keeps the ordered-list start number in the reply to %j', async (question, text, start, items) => {+ // A reply of exactly "144." is an ordered list that starts at 144 with an+ // empty item. Without its start number the bubble showed a bare "1.".+ const fetchMock = vi.fn(async (url, options = {}) => {+ if (url === '/api/talk/status') return response({ capabilities: { text_chat: true } })+ if (url === '/api/talk/message/stream' && options.method === 'POST') {+ return sseResponse([+ { type: 'session', session_id: 'sid' },+ { type: 'complete', session_id: 'sid', text, status: 'ok' },+ { type: 'done' },+ ])+ }+ throw new Error(`unexpected request: ${url}`)+ })+ vi.stubGlobal('fetch', fetchMock)++ const { container } = render(<ODSTalk />)+ expect(await screen.findByText('Ready')).toBeInTheDocument()+ fireEvent.change(screen.getByPlaceholderText('Message ODS'), {+ target: { value: question },+ })+ fireEvent.click(screen.getByRole('button', { name: 'Send message' }))++ await waitFor(() => expect(container.querySelector('ol')).toHaveAttribute('start', start))+ expect([...container.querySelectorAll('ol li')].map(item => item.textContent)).toEqual(items)+ })+test('renders dynamic SSE status caption + detail while a tool is in flight', async () => {// Bridge emits `status` frames between session and the first delta —// the SPA should swap the default "Thinking…" caption for the friendlydiff --git a/ods/extensions/services/dashboard/src/pages/Pixel.jsx b/ods/extensions/services/dashboard/src/pages/Pixel.jsxindex f1042bf7b..23a7dcc0e 100644--- a/ods/extensions/services/dashboard/src/pages/Pixel.jsx+++ b/ods/extensions/services/dashboard/src/pages/Pixel.jsx@@ -98,7 +98,9 @@ const keepModelAdvisory = current => current?.reason ? current : LEGACY_MODEL_SUconst MARKDOWN_COMPONENTS = {p: ({ children, className = '' }) => <p className={`break-words [&:not(:first-child)]:mt-3 ${className}`.trim()}>{children}</p>,ul: ({ children }) => <ul className="my-2 list-disc space-y-1 pl-5">{children}</ul>,- ol: ({ children }) => <ol className="my-2 list-decimal space-y-1 pl-5">{children}</ol>,+ // Keep the list's start number: a reply of exactly "144." is a list that+ // starts at 144 with an empty item, and dropping it showed a bare "1.".+ ol: ({ children, start }) => <ol start={start} className="my-2 list-decimal space-y-1 pl-5">{children}</ol>,li: ({ children }) => <li className="break-words">{children}</li>,strong: ({ children }) => <strong className="font-semibold">{children}</strong>,em: ({ children }) => <em className="italic">{children}</em>,diff --git a/ods/extensions/services/dashboard/src/pages/Pixel.test.jsx b/ods/extensions/services/dashboard/src/pages/Pixel.test.jsxindex 511908cce..62e09f627 100644--- a/ods/extensions/services/dashboard/src/pages/Pixel.test.jsx+++ b/ods/extensions/services/dashboard/src/pages/Pixel.test.jsx@@ -1214,6 +1214,27 @@ describe('Pixel', () => {.toMatchObject({ role: 'assistant', content, publication: preview }))})+ // Seen live: "what is 12 squared?" was answered exactly "144.", which+ // Markdown reads as an ordered list that starts at 144 with one empty item.+ // Without its start number the reply showed an empty "1." and lost the answer.+ it.each([+ ['what is 12 squared?', '144.', '144', ['']],+ ['what is left?', 'Steps 1 and 2 are done.\n\n3. Run the tests\n4. Open the pull request', '3', ['Run the tests', 'Open the pull request']],+ ])('keeps the ordered-list start number in the reply to %j', async (question, content, start, items) => {+ globalThis.fetch.mockResolvedValueOnce(response({available:true}))+ globalThis.fetch.mockResolvedValueOnce(sseResponse([JSON.stringify({choices:[{delta:{content}}]}),'[DONE]']))+ const {container}=render(<Pixel />)+ await screen.findByText('Available')+ fireEvent.change(screen.getByPlaceholderText('Message Portal...'),{target:{value:question}})+ fireEvent.click(screen.getByTitle('Send'))+ // Read the list once the whole reply is revealed. The reveal animation can+ // outlast the default one-second DOM wait on Windows CI.+ await waitFor(()=>expect(container.querySelector('.portal-streaming-text')).toHaveAttribute('aria-busy','false'),{timeout:5000})+ const list=container.querySelector('.portal-streaming-text ol')+ expect(list).toHaveAttribute('start',start)+ expect(within(list).getAllByRole('listitem').map(item=>item.textContent)).toEqual(items)+ })+it('preserves earlier file changes across another message and reload without sending UI metadata to the model', async () => {const publication = letter => {const sha256 = letter.repeat(64)