mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Use Streamdown (but the css is kinda messed up still)
This commit is contained in:
4 files changed
+52
-4
No files matched your search
Generated
+42
@@ -75,6 +75,7 @@
|
|||||||
"recharts": "^2.12.7",
|
"recharts": "^2.12.7",
|
||||||
"remark-gfm": "^4.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"sonner": "^1.5.0",
|
"sonner": "^1.5.0",
|
||||||
|
"streamdown": "^1.0.12",
|
||||||
"tailwind-merge": "^2.5.2",
|
"tailwind-merge": "^2.5.2",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"turndown": "^7.2.1",
|
"turndown": "^7.2.1",
|
||||||
@@ -10306,6 +10307,47 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/streamdown": {
|
||||||
|
"version": "1.0.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/streamdown/-/streamdown-1.0.12.tgz",
|
||||||
|
"integrity": "sha512-4vea/NYZE+gRcEZYS5PSU2IBFgH1zA2yklei9FvtlwJt9/oaRFnaUDpBDuD5EgdvqtUAGt4J2p4H/fZFgRi0Ow==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"clsx": "^2.1.1",
|
||||||
|
"harden-react-markdown": "^1.0.4",
|
||||||
|
"katex": "^0.16.22",
|
||||||
|
"lucide-react": "^0.539.0",
|
||||||
|
"marked": "^16.1.2",
|
||||||
|
"react-markdown": "^10.1.0",
|
||||||
|
"rehype-katex": "^7.0.1",
|
||||||
|
"remark-gfm": "^4.0.1",
|
||||||
|
"remark-math": "^6.0.0",
|
||||||
|
"shiki": "^3.9.2",
|
||||||
|
"tailwind-merge": "^3.3.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18.0.0 || ^19.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/streamdown/node_modules/lucide-react": {
|
||||||
|
"version": "0.539.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.539.0.tgz",
|
||||||
|
"integrity": "sha512-VVISr+VF2krO91FeuCrm1rSOLACQUYVy7NQkzrOty52Y8TlTPcXcMdQFj9bYzBgXbWCiywlwSZ3Z8u6a+6bMlg==",
|
||||||
|
"license": "ISC",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/streamdown/node_modules/tailwind-merge": {
|
||||||
|
"version": "3.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.3.1.tgz",
|
||||||
|
"integrity": "sha512-gBXpgUm/3rp1lMZZrM/w7D8GKqshif0zAymAhbCyIt8KMe+0v9DQ7cdYLR4FHH/cKpdTXb+A/tKKU3eolfsI+g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/dcastil"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/string_decoder": {
|
"node_modules/string_decoder": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
"recharts": "^2.12.7",
|
"recharts": "^2.12.7",
|
||||||
"remark-gfm": "^4.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"sonner": "^1.5.0",
|
"sonner": "^1.5.0",
|
||||||
|
"streamdown": "^1.0.12",
|
||||||
"tailwind-merge": "^2.5.2",
|
"tailwind-merge": "^2.5.2",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"turndown": "^7.2.1",
|
"turndown": "^7.2.1",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
import { Streamdown } from 'streamdown';
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||||
import { Bot, User, Square, Wrench } from 'lucide-react';
|
import { Bot, User, Square, Wrench } from 'lucide-react';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
@@ -67,7 +68,7 @@ export const AIMessageItem = memo(({
|
|||||||
})
|
})
|
||||||
.join('\n');
|
.join('\n');
|
||||||
}
|
}
|
||||||
return message.content || '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -116,7 +117,12 @@ export const AIMessageItem = memo(({
|
|||||||
</div>
|
</div>
|
||||||
<div className="text-sm">
|
<div className="text-sm">
|
||||||
<div className="whitespace-pre-wrap break-words">
|
<div className="whitespace-pre-wrap break-words">
|
||||||
{getContent()}
|
<Streamdown
|
||||||
|
className='size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0'
|
||||||
|
parseIncompleteMarkdown={isCurrentlyLoading}
|
||||||
|
>
|
||||||
|
{getContent()}
|
||||||
|
</Streamdown>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Display tool calls if present */}
|
{/* Display tool calls if present */}
|
||||||
|
|||||||
@@ -358,7 +358,6 @@ BASE_DOMAIN=nostrdeploy.com`);
|
|||||||
key={`${index}-${message.role}-${typeof message.content === 'string' ? message.content.slice(0, 50) : 'content'}`}
|
key={`${index}-${message.role}-${typeof message.content === 'string' ? message.content.slice(0, 50) : 'content'}`}
|
||||||
message={message}
|
message={message}
|
||||||
userDisplayName="You"
|
userDisplayName="You"
|
||||||
isCurrentlyLoading={false}
|
|
||||||
onStopGeneration={stopGeneration}
|
onStopGeneration={stopGeneration}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@@ -367,7 +366,7 @@ BASE_DOMAIN=nostrdeploy.com`);
|
|||||||
key="streaming-message"
|
key="streaming-message"
|
||||||
message={streamingMessage}
|
message={streamingMessage}
|
||||||
userDisplayName="You"
|
userDisplayName="You"
|
||||||
isCurrentlyLoading={true}
|
isCurrentlyLoading
|
||||||
onStopGeneration={stopGeneration}
|
onStopGeneration={stopGeneration}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in new issue
Block a user