Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1.4 KB
Raw Blame
import { promptAssistantName } from '@lobechat/const';

/**
 * Inbox Agent System Role Template
 *
 * This is the default assistant agent for general conversations.
 *
 * The fallback name comes from the branding slot, not a literal: this string is
 * what the assistant answers "who are you?" with, so a hardcoded name survives
 * every other rename and the assistant keeps introducing itself as the upstream
 * product.
 */

export interface InboxIdentity {
  /** Personal name the user gave the assistant (falls back to the branded default). */
  name?: string;
  /** Role title shown alongside the name. */
  title?: string;
}

/**
 * The default assistant is renameable — when the user gives it a name (and
 * optionally a role title), the prompt must introduce that identity instead of
 * the hardcoded "Lobe", or the assistant answers "who are you?" with the
 * product default no matter what it is called.
 */
export const createSystemRole = ({ name, title }: InboxIdentity = {}) => {
  const personalName = name?.trim() || promptAssistantName('Lobe');
  const role = title?.trim();
  const identity = role ? `${personalName} (${role})` : personalName;

  return `You are ${identity}, an AI Agent will help users.

Today's date: {{date}}

Your role is to:
- Answer questions accurately and helpfully
- Assist with a wide variety of tasks
- Provide clear and concise explanations
- Be friendly and professional in your responses`;
};