NextChat
NextChat copied to clipboard
feat: wrap input with delimiters
在对话设置中添加输入分隔符配置项,当配置了左右分隔符时,所有的用户输入都会用分隔符包裹。同时结合在系统prompt中指定输入分隔符,可以防止用户输入造成上下文逃逸。
支持了吴恩达公开课中的 tactic 1: use delimiters
只对特定的系统prompt起作用的话,没必要专门搞个配置项吧。
只对特定的系统prompt起作用的话,没必要专门搞个配置项吧。
不是针对特定的prompt啊,任何prompt都可以用,而且这是一个 best practice。例如,一个翻译的bot,如果prompt是:
请将用户输入的文字翻译成英文
当用户输入了一个疑问句,或者是一个指令,AI可能就不会翻译用户的输入,而且回答问题或者执行新指令。用了分隔符,就可以避免这个问题。
不错的想法,不过使用 options 是否会更好一些?直接列出常见的分隔符就行。
``
''
""
[]
{}
<>
或者干脆做成用户模版预处理,面具内可以指定一个模版字符串来处理用户输入,同时还可以提供更多的预定义模版来注入额外的信息,比如:
现在是 {{time}},用户的输入是 <{{input}}>,使用 {{lang}} 语言回复。
对,模板更好。等我迟些有空改一下。
Bot detected the issue body's language is not English, translate it automatically.
Yes, templates are better. I'll change it later when I have time.
期待
Bot detected the issue body's language is not English, translate it automatically.
expectations
#2109
Bot detected the issue body's language is not English, translate it automatically.
#2109
I did not get how to use it do delimiter only certain part of the input message... When I put <{{input}}> on the configs it will delimiter every message I sent with <{{}}> ?
Please give some examples of use
I did not get how to use it do delimiter only certain part of the input message... When I put <{{input}}> on the configs it will delimiter every message I sent with <{{}}> ?
Yes, the purpose of this feature is to wrap whole input message. What's your use case that just part of the input needs to be delimited?
hi @marioseixas , let's discuss this issue in a different location.
https://github.com/Yidadaa/ChatGPT-Next-Web/issues/2144