lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.39k stars 9.95k forks source link

[Request] 设置默认助手或提供修改默认对话prompts #3916

Closed blainehuang1028 closed 6 days ago

blainehuang1028 commented 2 months ago

🥰 需求描述

类似于一个可以为所有用户统一设置prompts或默认角色的功能,让访问者默认打开就是某个助手的对话框。

🧐 解决方案

增加全局设置prompts

📝 补充信息

或者开发者是否能提供一个临时方法,比如如何直接写死在配置文件或default文件中?(需要应付学校项目)

lobehubbot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


🥰 Description of requirements

It is similar to a function that can uniformly set prompts or default roles for all users, allowing visitors to open a dialog box of a certain assistant by default.

🧐 Solution

Add global setting prompts

📝 Supplementary information

Or can the developer provide a temporary method, such as how to directly write it in the configuration file or default file? (Needed to cope with school projects)

lobehubbot commented 2 months ago

👀 @blainehuang1028

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

dosubot[bot] commented 2 months ago

要设置默认助手或修改默认对话prompts,可以参考以下内容:

  1. 设置默认助手

    • 默认助手的相关文本在 "defaultAgent": "自定义助手""defaultSession": "自定义助手" 中定义。
    • 你可以通过 LobeChat 的角色市场添加助手,或者通过新建自定义助手来配置你的默认助手。
  2. 修改默认对话prompts

    • 默认对话prompts的相关文本在 "agentDefaultMessage""agentDefaultMessageWithSystemRole" 中定义。
    • 例如,"agentDefaultMessage": "你好,我是 **{{name}}**,你可以立即与我开始对话,也可以前往 [助手设置]({{url}}) 完善我的信息。" 定义了默认的对话提示。

以下是相关的 JSON 片段:

{
  "agentDefaultMessage": "你好,我是 **{{name}}**,你可以立即与我开始对话,也可以前往 [助手设置]({{url}}) 完善我的信息。",
  "agentDefaultMessageWithSystemRole": "你好,我是 **{{name}}**,{{systemRole}},让我们开始对话吧!",
  "agentDefaultMessageWithoutEdit": "你好,我是 **{{name}}**,让我们开始对话吧!",
  "defaultAgent": "自定义助手",
  "defaultSession": "自定义助手"
}

通过修改这些字段的值,可以设置默认助手和修改默认对话prompts。你还可以通过 LobeChat 的快捷设置技巧,通过侧边栏的快捷编辑按钮进行 Prompt 的便捷修改[1][2][3][4][5].

在 LobeChat 中,我们引入了 助手 的概念。助手是一个完整的功能模块,每个助手都有自己的职责和任务。助手可以帮助你处理各种任务,并提供专业的建议和指导。与此同时,我们将话题索引到每个助手内部。这样做的好处是,每个助手都有一个独立的话题列表,你可以根据当前任务选择对应的助手,并快速切换历史对话记录。这种方式更符合用户对常见聊天软件的使用习惯,提高了交互的效率。

此外,你可以在设置页面中找到更多关于助手和对话设置的选项。具体路径为:设置 -> 默认助手 -> 角色设定。你可以在这里修改助手的名称、描述、角色提示词等信息。

To continue talking to Dosu, mention @dosu.

lobehubbot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


To set the default assistant or modify the default conversation prompts, you can refer to the following:

  1. Set the default assistant:

    • The relevant text of the default assistant is defined in "defaultAgent": "Custom Assistant" and "defaultSession": "Custom Assistant".
    • You can add assistants through LobeChat's role market, or configure your default assistant by creating a new custom assistant.
  2. Modify default dialogue prompts:

    • The relevant text for default dialog prompts is defined in "agentDefaultMessage" and "agentDefaultMessageWithSystemRole".
    • For example, "agentDefaultMessage": "Hello, I am **{{name}}**, you can start a conversation with me immediately, or you can go to [Assistant Settings] ({{url}}) to complete my information . " defines the default dialog prompt.

Here is the relevant JSON snippet:

{
  "agentDefaultMessage": "Hello, I am **{{name}}**. You can start a conversation with me now, or you can go to [Assistant Settings]({{url}}) to complete my information.",
  "agentDefaultMessageWithSystemRole": "Hello, I am **{{name}}**, {{systemRole}}, let's start a conversation!",
  "agentDefaultMessageWithoutEdit": "Hello, I'm **{{name}}**, let's start a conversation!",
  "defaultAgent": "Custom Assistant",
  "defaultSession": "Custom Assistant"
}

By modifying the values ​​of these fields, you can set the default assistant and modify the default dialog prompts. You can also use LobeChat's quick setting skills to conveniently modify Prompt through the quick editing button in the sidebar [[1]](https://github.com/lobehub/lobe-chat/blob/main/ locales/zh-CN/chat.json)[[2]](https://github.com/lobehub/lobe-chat/blob/main/docs/usage/agents/custom-agent .zh-CN.mdx)[3]</ sup>[4] [5].

In LobeChat, we introduced the concept of assistants. The assistant is a complete functional module, and each assistant has its own responsibilities and tasks. Assistants can help you with various tasks and provide professional advice and guidance. At the same time, we index the topics inside each assistant. The advantage of this is that each assistant has an independent topic list. You can select the corresponding assistant according to the current task and quickly switch between historical conversation records. This method is more in line with users' usage habits of common chat software and improves the efficiency of interaction.

Additionally, you can find more options for Assistant and Conversation settings in the Settings page. The specific path is: Settings -> Default Assistant -> Role Settings. You can modify the assistant's name, description, role prompts and other information here.

To continue talking to Dosu, mention @dosu.

blainehuang1028 commented 2 months ago

@dosu 这似乎没有解决我的问题,我的意思是如何修改首页“随便聊聊”这一栏目的默认prompts,让所有人访问时无需额外操作即可直接与默认的prompts助手进行对话

lobehubbot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@dosu This doesn't seem to solve my problem. What I mean is how to modify the default prompts of the "Just Chat" column on the homepage so that everyone can directly talk to the default prompts assistant without additional operations when visiting.

dosubot[bot] commented 2 months ago

To modify the default prompts of the "Just Chat" column on the homepage so that everyone can directly talk to the default prompts assistant without additional operations when visiting, you need to update the inbox.desc field in the locales/zh-CN/chat.json file.

Here is the relevant JSON snippet with the modification:

{
  "inbox": {
    "desc": "开启大脑集群,激发思维火花。你的智能助理,在这里与你交流一切",
    "title": "随便聊聊"
  }
}

This change ensures that the description under the "Just Chat" column prompts users to start a conversation directly with the assistant [1].

To continue talking to Dosu, mention @dosu.

blainehuang1028 commented 2 months ago

@dosu 这一栏无法修改默认 prompts,只能修改标题文字

lobehubbot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@dosu This column cannot modify the default prompts, only the title text can be modified

dosubot[bot] commented 2 months ago

要修改首页“随便聊聊”这一栏的默认prompts,使所有人访问时无需额外操作即可直接与默认的prompts助手进行对话,你需要更新 locales/zh-CN/chat.json 文件中的 inbox.desc 字段。

以下是相关的 JSON 片段:

{
  "inbox": {
    "desc": "开启大脑集群,激发思维火花。你的智能助理,在这里与你交流一切",
    "title": "随便聊聊"
  }
}

此外,你还可以更新用户开始对话时助手发送的默认消息。这可以通过修改同一 JSON 文件中的 agentDefaultMessage 字段来实现:

{
  "agentDefaultMessage": "你好,我是 **{{name}}**。你可以立即与我开始对话!",
  "inbox": {
    "desc": "开启大脑集群,激发思维火花。你的智能助理,在这里与你交流一切",
    "title": "随便聊聊"
  }
}

这样修改后,用户在访问“随便聊聊”栏目时会看到提示信息,并且可以直接与默认的prompts助手进行对话[1][2].

To continue talking to Dosu, mention @dosu.

lobehubbot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


To modify the default prompts in the "Chat Casual" column on the homepage so that everyone can directly chat with the default prompts assistant without additional operations when accessing, you need to update the locales/zh-CN/chat.json file The inbox.desc field.

Here is the relevant JSON snippet:

{
  "inbox": {
    "desc": "Turn on the brain cluster and stimulate the spark of thinking. Your intelligent assistant is here to communicate with you about everything",
    "title": "Just chat"
  }
}

Additionally, you can update the default message your assistant sends when a user starts a conversation. This can be achieved by modifying the agentDefaultMessage field in the same JSON file:

{
  "agentDefaultMessage": "Hello, I'm **{{name}}**. You can start a conversation with me now!",
  "inbox": {
    "desc": "Turn on the brain cluster and stimulate the spark of thinking. Your intelligent assistant is here to communicate with you about everything",
    "title": "Just chat"
  }
}

After this modification, users will see prompt information when accessing the "Chat Casually" column, and can directly talk to the default prompts assistant [[1]](https://github.com/lobehub/lobe -chat/blob/main/locales/en-US/chat.json)[[2]](https://github.com/lobehub/lobe-chat/blob/main/locales/ de-DE/chat.json).

To continue talking to Dosu, mention @dosu.

arvinxx commented 6 days ago

自己改这里 https://github.com/lobehub/lobe-chat/blob/main/src/const/settings/agent.ts#L23-L36

lobehubbot commented 6 days ago

✅ @blainehuang1028

This issue is closed, If you have any questions, you can comment and reply.\ 此问题已经关闭。如果您有任何问题,可以留言并回复。