Skip to content

Commit a545a90

Browse files
committed
chore(chat): align streaming constants with type conventions
1 parent 33e83ba commit a545a90

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ const LANG_ALIASES: Record<string, string> = {
6868
py: 'python',
6969
}
7070

71-
const MARKDOWN_REMARK_PLUGINS = [...Object.values(defaultRemarkPlugins), remarkPlainText]
71+
const MARKDOWN_REMARK_PLUGINS = [
72+
...Object.values(defaultRemarkPlugins),
73+
remarkPlainText,
74+
] as const satisfies NonNullable<ComponentPropsWithoutRef<typeof Streamdown>['remarkPlugins']>
7275

7376
const PROSE_CLASSES = cn(
7477
'prose prose-base dark:prose-invert max-w-none',

‎apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/highlighted-lines.test.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ describe('highlighted code lines', () => {
3333
'/* a comment\nwith <script>alert(1)</script>\n*/\nconst x = "safe"',
3434
'<div title="a &amp; b">\n <!-- multi\n line -->\n</div>',
3535
'const x = "<img src=x onerror=alert(1)>"\n\nconst y = 1',
36-
]
36+
] as const
3737
for (const code of cases) {
3838
for (let end = 1; end <= code.length; end++) {
3939
const prefix = code.slice(0, end)
40-
for (const language of ['typescript', 'markup']) {
40+
for (const language of ['typescript', 'markup'] as const) {
4141
const html = Prism.highlight(prefix, Prism.languages[language], language)
4242
const before = document.createElement('pre')
4343
before.innerHTML = html

‎apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/remark-plain-text.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('plain-paragraph parsing', () => {
1616
'A sentence with (parentheses), quotes, 1.23 and 20% off.',
1717
'12)word',
1818
'Plain\u000btext\u000ctext',
19-
]) {
19+
] as const) {
2020
for (let end = 0; end <= text.length; end++) {
2121
const prefix = text.slice(0, end)
2222
expect(optimized.parse(prefix), JSON.stringify(prefix)).toEqual(reference.parse(prefix))
@@ -42,7 +42,7 @@ describe('plain-paragraph parsing', () => {
4242
'[link][ref]\n\n[ref]: https://example.com',
4343
'```typescript\nconst text = `multiline\nvalue`\n```',
4444
'\ufeffText',
45-
]
45+
] as const
4646
for (const text of cases) {
4747
for (let end = 0; end <= text.length; end++) {
4848
const prefix = text.slice(0, end)
@@ -57,7 +57,7 @@ describe('plain-paragraph parsing', () => {
5757
'## Heading\n\nA paragraph.\n\n- A list item\n\n| Column |\n| --- |\n| Cell |\n\n'.repeat(30),
5858
`\`\`\`typescript\n${'const value = items.map((item) => item.value)\n'.repeat(40)}\`\`\``,
5959
'A citation. <source>{"url":"https://example.com"}</source>\n\n'.repeat(30),
60-
]
60+
] as const
6161
for (const text of cases) {
6262
for (let end = 7; end <= text.length; end += 7) {
6363
expect(optimized.parse(text.slice(0, end))).toEqual(reference.parse(text.slice(0, end)))

0 commit comments

Comments
 (0)