Hook up hidden agent creation and update APIs to the UI

- This allows users to initiate hidden agent creation from the side bar directly. Any updates can easily be applied to the conversation agent.
This commit is contained in:
sabaimran
2025-01-19 17:36:30 -08:00
parent be11f666e4
commit b248123135
9 changed files with 316 additions and 129 deletions

View File

@@ -17,7 +17,7 @@ import { Lightbulb, ArrowDown, XCircle } from "@phosphor-icons/react";
import AgentProfileCard from "../profileCard/profileCard";
import { getIconFromIconName } from "@/app/common/iconUtils";
import { AgentData } from "@/app/agents/page";
import { AgentData } from "../agentCard/agentCard";
import React from "react";
import { useIsMobileWidth } from "@/app/common/utils";
import { Button } from "@/components/ui/button";
@@ -281,12 +281,20 @@ export default function ChatHistory(props: ChatHistoryProps) {
function constructAgentName() {
if (!data || !data.agent || !data.agent?.name) return `Agent`;
if (data.agent.is_hidden) return 'Khoj';
console.log(data.agent);
return data.agent?.name;
}
function constructAgentPersona() {
if (!data || !data.agent || !data.agent?.persona)
if (!data || !data.agent) {
return `Your agent is no longer available. You will be reset to the default agent.`;
}
if (!data.agent?.persona) {
return `You can set a persona for your agent in the Chat Options side panel.`;
}
return data.agent?.persona;
}