Skip to content

[Tips] 如何使用用户输入模板 How to use Input Template #2144

Closed
@Yidadaa

Description

在最近的一次更新中,我增加了 Input Template 这个功能,讨论可以看这里:#1789

image

该配置项可以在全局设置和对话设置中更改,影响的范围也不一样,同时不同的预处理模板,产生的效果也不同。

总而言之,你可以在模板中使用下方的变量:

https://github.com/Yidadaa/ChatGPT-Next-Web/blob/5f7c262759b93c6becc636b7b0cab2a183c956fe/app/store/chat.ts#L110-L116

  • {{model}}: 当前使用的模型名称
  • {{time}}: 当前本地时间
  • {{lang}}: 当前所用语言
  • {{input}}: 用户本次输入

举个例子,在最开始的版本中,我设定的默认模板是:

Act as a virtual assistant powered by model: '{{model}}', now time is {{time}}, response in {{lang}} lang, my input is:'''{{input}}'''

那么如果用户输入了 how are you today?,根据上述模板,发送给 ChatGPT 的内容会变成:

Act as a virtual assistant powered by model: 'gpt-3.5-turbo', now time is 2023/06/26 12:50, response in zh lang, my input is:'''how are you today?'''

然而,这个默认模板会在某些情况下污染用户的预设提示词,所以在当前的版本中,我又改成了最基础的:

https://github.com/Yidadaa/ChatGPT-Next-Web/blob/5f7c262759b93c6becc636b7b0cab2a183c956fe/app/constant.ts#L56

后来,我发现 OpenAI 的网页版 ChatGPT,用的系统提示词是:

You are ChatGPT, a large language model trained by OpenAI.
Knowledge cutoff: 2021-09
Current date: [current date]

所以,我接下来会将此提示词全局注入,来尽可能接近官方的使用体验。

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationfaqMost asked questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions