Spaces:
Paused
Paused
Soham Waghmare
commited on
Commit
·
ac03e8a
1
Parent(s):
0a3d9b7
fix: frontend: stylefix
Browse files
frontend/src/components/Message.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import { Avatar } from "@/components/ui/avatar";
|
|
|
|
| 2 |
import { Button } from "@/components/ui/button";
|
| 3 |
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
| 4 |
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
|
@@ -17,11 +18,13 @@ const MarkdownComponents: Record<string, React.ComponentType<any>> = {
|
|
| 17 |
ol: ({ children }) => <ol className="list-decimal ml-6 mb-4">{children}</ol>,
|
| 18 |
li: ({ children }) => <li className="mb-1">{children}</li>,
|
| 19 |
code: ({ node, inline, className, children, ...props }) => (
|
| 20 |
-
<
|
| 21 |
-
{
|
| 22 |
-
|
|
|
|
|
|
|
| 23 |
),
|
| 24 |
-
pre: ({ children }) => <pre className="bg-transparent p-0">{children}</pre>,
|
| 25 |
a: ({ children, href }) => (
|
| 26 |
<a href={href} className="text-primary hover:underline" target="_blank" rel="noopener noreferrer">
|
| 27 |
{children}
|
|
@@ -45,7 +48,7 @@ const Message = ({ message }: { message: MessageType }) => {
|
|
| 45 |
<div className={`max-w-2xl mx-auto flex gap-4 relative ${isUser ? "flex-row-reverse" : ""}`}>
|
| 46 |
<Avatar className={`h-8 w-8 shrink-0 absolute justify-center item-center ${isUser ? "-right-12" : "-left-12"} top-0`}>{isUser ? <User2 className="h-5 w-5" /> : <Bot className="h-5 w-5" />}</Avatar>
|
| 47 |
|
| 48 |
-
<div className={`flex-1 ${isUser ? "items-end" : "items-start"}`}>
|
| 49 |
<div className={`flex items-center gap-2 mb-1 ${isUser ? "justify-end" : "justify-start"}`}>
|
| 50 |
{isUser && <div className="text-xs text-muted-foreground">{new Date(message.timestamp).toLocaleTimeString()}</div>}
|
| 51 |
<div className="font-medium">{isUser ? "You" : "KNet"}</div>
|
|
|
|
| 1 |
import { Avatar } from "@/components/ui/avatar";
|
| 2 |
+
import { ScrollArea } from "@/components/ui/scroll-area";
|
| 3 |
import { Button } from "@/components/ui/button";
|
| 4 |
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
| 5 |
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
|
|
|
| 18 |
ol: ({ children }) => <ol className="list-decimal ml-6 mb-4">{children}</ol>,
|
| 19 |
li: ({ children }) => <li className="mb-1">{children}</li>,
|
| 20 |
code: ({ node, inline, className, children, ...props }) => (
|
| 21 |
+
// <ScrollArea asChild >
|
| 22 |
+
<code className={`${Object.keys(node.properties).length === 0 ? "bg-muted px-1 py-0.5 rounded-md text-sm" : "block bg-muted p-1 rounded-lg text-sm overflow-x-auto max-w-full mb-1"}`} {...props}>
|
| 23 |
+
{children}
|
| 24 |
+
</code>
|
| 25 |
+
// </ScrollArea>
|
| 26 |
),
|
| 27 |
+
pre: ({ children }) => <pre className="bg-transparent p-0 max-w-full overflow-x-auto">{children}</pre>,
|
| 28 |
a: ({ children, href }) => (
|
| 29 |
<a href={href} className="text-primary hover:underline" target="_blank" rel="noopener noreferrer">
|
| 30 |
{children}
|
|
|
|
| 48 |
<div className={`max-w-2xl mx-auto flex gap-4 relative ${isUser ? "flex-row-reverse" : ""}`}>
|
| 49 |
<Avatar className={`h-8 w-8 shrink-0 absolute justify-center item-center ${isUser ? "-right-12" : "-left-12"} top-0`}>{isUser ? <User2 className="h-5 w-5" /> : <Bot className="h-5 w-5" />}</Avatar>
|
| 50 |
|
| 51 |
+
<div className={`max-w-2xl flex-1 ${isUser ? "items-end" : "items-start"}`}>
|
| 52 |
<div className={`flex items-center gap-2 mb-1 ${isUser ? "justify-end" : "justify-start"}`}>
|
| 53 |
{isUser && <div className="text-xs text-muted-foreground">{new Date(message.timestamp).toLocaleTimeString()}</div>}
|
| 54 |
<div className="font-medium">{isUser ? "You" : "KNet"}</div>
|
frontend/src/components/ui/ConversationList.tsx
CHANGED
|
@@ -29,11 +29,12 @@ const ConversationList: React.FC<ConversationListProps> = ({ conversations, onNe
|
|
| 29 |
{conversations.length === 0 ? (
|
| 30 |
<p className="text-sm text-muted-foreground px-2">No conversations yet</p>
|
| 31 |
) : (
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
| 37 |
<Button
|
| 38 |
variant="ghost"
|
| 39 |
size="icon"
|
|
@@ -44,10 +45,9 @@ const ConversationList: React.FC<ConversationListProps> = ({ conversations, onNe
|
|
| 44 |
}}>
|
| 45 |
<XCircle className="h-4 w-4" />
|
| 46 |
</Button>
|
| 47 |
-
</
|
| 48 |
-
|
| 49 |
-
)
|
| 50 |
-
)}
|
| 51 |
</div>
|
| 52 |
</div>
|
| 53 |
</div>
|
|
|
|
| 29 |
{conversations.length === 0 ? (
|
| 30 |
<p className="text-sm text-muted-foreground px-2">No conversations yet</p>
|
| 31 |
) : (
|
| 32 |
+
conversations.map((conversation) => (
|
| 33 |
+
<div key={conversation.id} className="flex items-center gap-1 px-1 group">
|
| 34 |
+
<Button variant={conversation.active ? "secondary" : "ghost"} className={`flex-1 pr-0.5 justify-start text-left truncate ${conversation.active ? "bg-accent" : ""}`} onClick={() => handleSelectConversation(conversation.id)}>
|
| 35 |
+
<MessageSquare className="mr-2 h-4 w-4 shrink-0" />
|
| 36 |
+
<span className="truncate">{conversation.title}</span>
|
| 37 |
+
</Button>
|
| 38 |
<Button
|
| 39 |
variant="ghost"
|
| 40 |
size="icon"
|
|
|
|
| 45 |
}}>
|
| 46 |
<XCircle className="h-4 w-4" />
|
| 47 |
</Button>
|
| 48 |
+
</div>
|
| 49 |
+
))
|
| 50 |
+
)}
|
|
|
|
| 51 |
</div>
|
| 52 |
</div>
|
| 53 |
</div>
|