mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 05:29:12 +00:00
Include agent personality through subtasks and support custom agents (#916)
Currently, the personality of the agent is only included in the final response that it returns to the user. Historically, this was because models were quite bad at navigating the additional context of personality, and there was a bias towards having more control over certain operations (e.g., tool selection, question extraction). Going forward, it should be more approachable to have prompts included in the sub tasks that Khoj runs in order to response to a given query. Make this possible in this PR. This also sets us up for agent creation becoming available soon. Create custom agents in #928 Agents are useful insofar as you can personalize them to fulfill specific subtasks you need to accomplish. In this PR, we add support for using custom agents that can be configured with a custom system prompt (aka persona) and knowledge base (from your own indexed documents). Once created, private agents can be accessible only to the creator, and protected agents can be accessible via a direct link. Custom tool selection for agents in #930 Expose the functionality to select which tools a given agent has access to. By default, they have all. Can limit both information sources and output modes. Add new tools to the agent modification form
This commit is contained in:
@@ -36,6 +36,15 @@ export interface SyncedContent {
|
||||
github: boolean;
|
||||
notion: boolean;
|
||||
}
|
||||
|
||||
export enum SubscriptionStates {
|
||||
EXPIRED = "expired",
|
||||
TRIAL = "trial",
|
||||
SUBSCRIBED = "subscribed",
|
||||
UNSUBSCRIBED = "unsubscribed",
|
||||
INVALID = "invalid",
|
||||
}
|
||||
|
||||
export interface UserConfig {
|
||||
// user info
|
||||
username: string;
|
||||
@@ -58,7 +67,7 @@ export interface UserConfig {
|
||||
voice_model_options: ModelOptions[];
|
||||
selected_voice_model_config: number;
|
||||
// user billing info
|
||||
subscription_state: string;
|
||||
subscription_state: SubscriptionStates;
|
||||
subscription_renewal_date: string;
|
||||
// server settings
|
||||
khoj_cloud_subscription_url: string | undefined;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const tailwindColors = [
|
||||
export const tailwindColors = [
|
||||
"red",
|
||||
"yellow",
|
||||
"green",
|
||||
|
||||
@@ -26,6 +26,28 @@ import {
|
||||
Wallet,
|
||||
PencilLine,
|
||||
Chalkboard,
|
||||
Gps,
|
||||
Question,
|
||||
Browser,
|
||||
Notebook,
|
||||
Shapes,
|
||||
ChatsTeardrop,
|
||||
GlobeSimple,
|
||||
ArrowRight,
|
||||
Cigarette,
|
||||
CraneTower,
|
||||
Heart,
|
||||
Leaf,
|
||||
NewspaperClipping,
|
||||
OrangeSlice,
|
||||
Rainbow,
|
||||
SmileyMelting,
|
||||
YinYang,
|
||||
SneakerMove,
|
||||
Student,
|
||||
Oven,
|
||||
Gavel,
|
||||
Broadcast,
|
||||
} from "@phosphor-icons/react";
|
||||
import { Markdown, OrgMode, Pdf, Word } from "@/app/components/logo/fileLogo";
|
||||
|
||||
@@ -103,8 +125,92 @@ const iconMap: IconMap = {
|
||||
Chalkboard: (color: string, width: string, height: string) => (
|
||||
<Chalkboard className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
Cigarette: (color: string, width: string, height: string) => (
|
||||
<Cigarette className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
CraneTower: (color: string, width: string, height: string) => (
|
||||
<CraneTower className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
Heart: (color: string, width: string, height: string) => (
|
||||
<Heart className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
Leaf: (color: string, width: string, height: string) => (
|
||||
<Leaf className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
NewspaperClipping: (color: string, width: string, height: string) => (
|
||||
<NewspaperClipping className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
OrangeSlice: (color: string, width: string, height: string) => (
|
||||
<OrangeSlice className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
SmileyMelting: (color: string, width: string, height: string) => (
|
||||
<SmileyMelting className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
YinYang: (color: string, width: string, height: string) => (
|
||||
<YinYang className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
SneakerMove: (color: string, width: string, height: string) => (
|
||||
<SneakerMove className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
Student: (color: string, width: string, height: string) => (
|
||||
<Student className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
Oven: (color: string, width: string, height: string) => (
|
||||
<Oven className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
Gavel: (color: string, width: string, height: string) => (
|
||||
<Gavel className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
Broadcast: (color: string, width: string, height: string) => (
|
||||
<Broadcast className={`${width} ${height} ${color} mr-2`} />
|
||||
),
|
||||
};
|
||||
|
||||
export function getIconForSlashCommand(command: string, customClassName: string | null = null) {
|
||||
const className = customClassName ?? "h-4 w-4";
|
||||
if (command.includes("summarize")) {
|
||||
return <Gps className={className} />;
|
||||
}
|
||||
|
||||
if (command.includes("help")) {
|
||||
return <Question className={className} />;
|
||||
}
|
||||
|
||||
if (command.includes("automation")) {
|
||||
return <Robot className={className} />;
|
||||
}
|
||||
|
||||
if (command.includes("webpage")) {
|
||||
return <Browser className={className} />;
|
||||
}
|
||||
|
||||
if (command.includes("notes")) {
|
||||
return <Notebook className={className} />;
|
||||
}
|
||||
|
||||
if (command.includes("image")) {
|
||||
return <Image className={className} />;
|
||||
}
|
||||
|
||||
if (command.includes("default")) {
|
||||
return <Shapes className={className} />;
|
||||
}
|
||||
|
||||
if (command.includes("general")) {
|
||||
return <ChatsTeardrop className={className} />;
|
||||
}
|
||||
|
||||
if (command.includes("online")) {
|
||||
return <GlobeSimple className={className} />;
|
||||
}
|
||||
|
||||
if (command.includes("text")) {
|
||||
return <PencilLine className={className} />;
|
||||
}
|
||||
|
||||
return <ArrowRight className={className} />;
|
||||
}
|
||||
|
||||
function getIconFromIconName(
|
||||
iconName: string,
|
||||
color: string = "gray",
|
||||
@@ -141,4 +247,8 @@ function getIconFromFilename(
|
||||
}
|
||||
}
|
||||
|
||||
export { getIconFromIconName, getIconFromFilename };
|
||||
function getAvailableIcons() {
|
||||
return Object.keys(iconMap);
|
||||
}
|
||||
|
||||
export { getIconFromIconName, getIconFromFilename, getAvailableIcons };
|
||||
|
||||
Reference in New Issue
Block a user