mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Skip showing hidden agents in the all conversations agent filter
This commit is contained in:
@@ -62,6 +62,7 @@ interface ChatHistory {
|
|||||||
agent_name: string;
|
agent_name: string;
|
||||||
agent_icon: string;
|
agent_icon: string;
|
||||||
agent_color: string;
|
agent_color: string;
|
||||||
|
agent_is_hidden: boolean;
|
||||||
compressed: boolean;
|
compressed: boolean;
|
||||||
created: string;
|
created: string;
|
||||||
updated: string;
|
updated: string;
|
||||||
@@ -465,6 +466,7 @@ function SessionsAndFiles(props: SessionsAndFilesProps) {
|
|||||||
agent_name={chatHistory.agent_name}
|
agent_name={chatHistory.agent_name}
|
||||||
agent_color={chatHistory.agent_color}
|
agent_color={chatHistory.agent_color}
|
||||||
agent_icon={chatHistory.agent_icon}
|
agent_icon={chatHistory.agent_icon}
|
||||||
|
agent_is_hidden={chatHistory.agent_is_hidden}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
)}
|
)}
|
||||||
@@ -694,7 +696,7 @@ function ChatSession(props: ChatHistory) {
|
|||||||
onMouseEnter={() => setIsHovered(true)}
|
onMouseEnter={() => setIsHovered(true)}
|
||||||
onMouseLeave={() => setIsHovered(false)}
|
onMouseLeave={() => setIsHovered(false)}
|
||||||
key={props.conversation_id}
|
key={props.conversation_id}
|
||||||
className={`${styles.session} ${props.compressed ? styles.compressed : "!max-w-full"} ${isHovered ? `${styles.sessionHover}` : ""} ${currConversationId === props.conversation_id && currConversationId != "-1" ? "dark:bg-neutral-800 bg-white" : ""}`}
|
className={`${styles.session} ${props.compressed ? styles.compressed : "!max-w-full"} ${isHovered ? `${styles.sessionHover}` : ""} ${currConversationId === props.conversation_id && currConversationId != "-1" ? "dark:bg-neutral-800 bg-white" : ""} m-1`}
|
||||||
>
|
>
|
||||||
<SidebarMenuButton asChild>
|
<SidebarMenuButton asChild>
|
||||||
<Link
|
<Link
|
||||||
@@ -740,14 +742,21 @@ function ChatSessionsModal({ data, sideBarOpen }: ChatSessionsModalProps) {
|
|||||||
let agentNameToStyleMapLocal: Record<string, AgentStyle> = {};
|
let agentNameToStyleMapLocal: Record<string, AgentStyle> = {};
|
||||||
Object.keys(data).forEach((timeGrouping) => {
|
Object.keys(data).forEach((timeGrouping) => {
|
||||||
data[timeGrouping].forEach((chatHistory) => {
|
data[timeGrouping].forEach((chatHistory) => {
|
||||||
if (!agents.includes(chatHistory.agent_name) && chatHistory.agent_name) {
|
if (chatHistory.agent_is_hidden) return;
|
||||||
|
if (!chatHistory.agent_color) return;
|
||||||
|
if (!chatHistory.agent_name) return;
|
||||||
|
if (!chatHistory.agent_icon) return;
|
||||||
|
|
||||||
|
const agentName = chatHistory.agent_name;
|
||||||
|
|
||||||
|
if (agentName && !agents.includes(agentName)) {
|
||||||
agents.push(chatHistory.agent_name);
|
agents.push(chatHistory.agent_name);
|
||||||
|
|
||||||
agentNameToStyleMapLocal = {
|
agentNameToStyleMapLocal = {
|
||||||
...agentNameToStyleMapLocal,
|
...agentNameToStyleMapLocal,
|
||||||
[chatHistory.agent_name]: {
|
[chatHistory.agent_name]: {
|
||||||
color: chatHistory.agent_color,
|
color: chatHistory.agent_color ?? "orange",
|
||||||
icon: chatHistory.agent_icon,
|
icon: chatHistory.agent_icon ?? "Lightbulb",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -875,6 +884,7 @@ function ChatSessionsModal({ data, sideBarOpen }: ChatSessionsModalProps) {
|
|||||||
agent_name={chatHistory.agent_name}
|
agent_name={chatHistory.agent_name}
|
||||||
agent_color={chatHistory.agent_color}
|
agent_color={chatHistory.agent_color}
|
||||||
agent_icon={chatHistory.agent_icon}
|
agent_icon={chatHistory.agent_icon}
|
||||||
|
agent_is_hidden={chatHistory.agent_is_hidden}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ p.session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
p.compressed {
|
p.compressed {
|
||||||
width: 12rem;
|
width: 11rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.expanded {
|
p.expanded {
|
||||||
|
|||||||
@@ -457,6 +457,7 @@ def chat_sessions(
|
|||||||
"updated_at",
|
"updated_at",
|
||||||
"agent__style_icon",
|
"agent__style_icon",
|
||||||
"agent__style_color",
|
"agent__style_color",
|
||||||
|
"agent__is_hidden",
|
||||||
)
|
)
|
||||||
|
|
||||||
session_values = [
|
session_values = [
|
||||||
@@ -468,6 +469,7 @@ def chat_sessions(
|
|||||||
"updated": session[6].strftime("%Y-%m-%d %H:%M:%S"),
|
"updated": session[6].strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
"agent_icon": session[7],
|
"agent_icon": session[7],
|
||||||
"agent_color": session[8],
|
"agent_color": session[8],
|
||||||
|
"agent_is_hidden": session[9],
|
||||||
}
|
}
|
||||||
for session in sessions
|
for session in sessions
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user