Skip to content

Commit

Permalink
Merge pull request #18 from technologiestiftung/feat/add-line-clamp
Browse files Browse the repository at this point in the history
fix: add line clamp on history items
  • Loading branch information
raphael-arce authored May 25, 2023
2 parents 5173ab6 + 73b90a3 commit 6dd19f7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions components/sidebars/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChatbotOeffentlichesGestaltenLogo } from "../logos";
import React, { useEffect } from "react";
import { MessageIcon } from "../icons";
import { useChatbotStore } from "../../store";
import {getLocalChatSessionHistory} from "../../lib/local-storage";
import { getLocalChatSessionHistory } from "../../lib/local-storage";
import { ChatSession } from "../../types/chat";

export const Sidebar = () => {
Expand Down Expand Up @@ -30,11 +30,15 @@ export const Sidebar = () => {
setCurrentChatSession(selectedChatSession);

const lastMessage = selectedChatSession.messages.at(-1);
if (lastMessage?.role !=='user') {
if (lastMessage?.role !== "user") {
return;
}

handleConfirm({ query: lastMessage.content, isNewSession: false, isNewMessage: false });
handleConfirm({
query: lastMessage.content,
isNewSession: false,
isNewMessage: false,
});
}

function handleNewChatClick() {
Expand All @@ -56,7 +60,9 @@ export const Sidebar = () => {
<div>
<MessageIcon />
</div>
<div className="grow">{chatSession.title || chatSession.messages[0].content}</div>
<div className="grow line-clamp-3">
{chatSession.title || chatSession.messages[0].content}
</div>
</button>
</li>
));
Expand Down

1 comment on commit 6dd19f7

@vercel
Copy link

@vercel vercel bot commented on 6dd19f7 May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.