diff --git a/src/interface/web/app/components/chatHistory/chatHistory.module.css b/src/interface/web/app/components/chatHistory/chatHistory.module.css index 0e623b77..c379460b 100644 --- a/src/interface/web/app/components/chatHistory/chatHistory.module.css +++ b/src/interface/web/app/components/chatHistory/chatHistory.module.css @@ -17,10 +17,6 @@ div.agentIndicator a { align-items: center; } -div.agentIndicator { - padding: 10px; -} - div.trainOfThought { border: 1px var(--border-color) solid; border-radius: 16px; diff --git a/src/interface/web/app/components/chatHistory/chatHistory.tsx b/src/interface/web/app/components/chatHistory/chatHistory.tsx index c9b44f7d..d8052a04 100644 --- a/src/interface/web/app/components/chatHistory/chatHistory.tsx +++ b/src/interface/web/app/components/chatHistory/chatHistory.tsx @@ -11,9 +11,10 @@ import renderMathInElement from 'katex/contrib/auto-render'; import 'katex/dist/katex.min.css'; import 'highlight.js/styles/github.css' -import Loading, { InlineLoading } from '../loading/loading'; +import { InlineLoading } from '../loading/loading'; -import { Lightbulb } from "@phosphor-icons/react"; +import ProfileCard from '../profileCard/profileCard'; +import { Lightbulb } from '@phosphor-icons/react'; interface ChatResponse { status: string; @@ -232,6 +233,10 @@ export default function ChatHistory(props: ChatHistoryProps) { return data.agent.name; } + function constructAgentPersona() { + if (!data || !data.agent || !data.agent.persona) return ``; + return data.agent.persona; + } if (!props.conversationId && !props.publicConversationSlug) { return null; @@ -323,11 +328,15 @@ export default function ChatHistory(props: ChatHistoryProps) { isLastMessage={true} /> } -
- - - {constructAgentName()} - +
+
+ } + description={constructAgentPersona()} + /> +
diff --git a/src/interface/web/app/components/chatMessage/chatMessage.tsx b/src/interface/web/app/components/chatMessage/chatMessage.tsx index 76e43b4b..188e0f86 100644 --- a/src/interface/web/app/components/chatMessage/chatMessage.tsx +++ b/src/interface/web/app/components/chatMessage/chatMessage.tsx @@ -76,6 +76,7 @@ interface AgentData { name: string; avatar: string; slug: string; + persona: string; } interface Intent { diff --git a/src/interface/web/app/components/profileCard/profileCard.module.css b/src/interface/web/app/components/profileCard/profileCard.module.css new file mode 100644 index 00000000..e69de29b diff --git a/src/interface/web/app/components/profileCard/profileCard.tsx b/src/interface/web/app/components/profileCard/profileCard.tsx new file mode 100644 index 00000000..ac3ec2e6 --- /dev/null +++ b/src/interface/web/app/components/profileCard/profileCard.tsx @@ -0,0 +1,36 @@ +import React from 'react'; +import { ArrowRight } from '@phosphor-icons/react'; + +interface ProfileCardProps { + name: string; + avatar: JSX.Element; + link: string; + description?: string; // Optional description field +} + +const ProfileCard: React.FC = ({ name, avatar, link, description }) => { + return ( +
+ {avatar} + {name} +
+
+ {avatar} + + {name} + + + + +
+ {description && ( +

+ {description || 'A Khoj agent'} +

+ )} +
+
+ ); +}; + +export default ProfileCard; diff --git a/src/interface/web/package.json b/src/interface/web/package.json index e762b974..fd580233 100644 --- a/src/interface/web/package.json +++ b/src/interface/web/package.json @@ -31,6 +31,7 @@ "@radix-ui/react-scroll-area": "^1.1.0", "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-toggle": "^1.1.0", + "@tailwindcss/line-clamp": "^0.4.4", "@types/dompurify": "^3.0.5", "@types/katex": "^0.16.7", "@types/markdown-it": "^14.1.1", diff --git a/src/interface/web/tailwind.config.ts b/src/interface/web/tailwind.config.ts index fcfc7674..f65744f5 100644 --- a/src/interface/web/tailwind.config.ts +++ b/src/interface/web/tailwind.config.ts @@ -74,7 +74,10 @@ const config = { }, }, }, - plugins: [require("tailwindcss-animate")], + plugins: [ + require("tailwindcss-animate"), + require('@tailwindcss/line-clamp'), + ], } satisfies Config export default config diff --git a/src/interface/web/yarn.lock b/src/interface/web/yarn.lock index 27c25989..adeebfea 100644 --- a/src/interface/web/yarn.lock +++ b/src/interface/web/yarn.lock @@ -1035,6 +1035,11 @@ "@swc/counter" "^0.1.3" tslib "^2.4.0" +"@tailwindcss/line-clamp@^0.4.4": + version "0.4.4" + resolved "https://registry.yarnpkg.com/@tailwindcss/line-clamp/-/line-clamp-0.4.4.tgz#767cf8e5d528a5d90c9740ca66eb079f5e87d423" + integrity sha512-5U6SY5z8N42VtrCrKlsTAA35gy2VSyYtHWCsg1H87NU1SXnEfekTVlrga9fzUDrrHcGi2Lb5KenUWb4lRQT5/g== + "@ts-morph/common@~0.19.0": version "0.19.0" resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.19.0.tgz#927fcd81d1bbc09c89c4a310a84577fb55f3694e" diff --git a/src/khoj/routers/api_chat.py b/src/khoj/routers/api_chat.py index debb6f61..15e7a143 100644 --- a/src/khoj/routers/api_chat.py +++ b/src/khoj/routers/api_chat.py @@ -212,6 +212,7 @@ def chat_history( "name": conversation.agent.name, "avatar": conversation.agent.avatar, "isCreator": conversation.agent.creator == user, + "persona": conversation.agent.personality, } meta_log = conversation.conversation_log @@ -266,6 +267,7 @@ def get_shared_chat( "name": conversation.agent.name, "avatar": conversation.agent.avatar, "isCreator": conversation.agent.creator == user, + "persona": conversation.agent.personality, } meta_log = conversation.conversation_log