javascript - 如何让“msg.content”不断地添加新字符串而不是替换?
问题描述
var collector = new MessageCollector(message.channel, filter, {
max: 10,
time: 60000,
})
collector.on("collect", (msg) => {
console.log(msg.content)
openai.Completion.create({
engine: "davinci",
prompt: msg.content,
temperature: 0.9,
max_tokens: 150,
top_p: 1,
frequency_penalty: 0.35,
presence_penalty: 0.6,
stop: ["\n", " Human:", " AI:"]
}).then((response) => {
message.channel.send(response.choices[0].text)
})
})
}
所以我试图将人工智能“GPT-3”实现到一个不和谐的机器人中,看看它是如何工作的,但是 GPT-3 需要一直知道提示(基本上是对话的上下文)。通过我设置它的方式,一旦变量(msg.content)被“MessageCollector”抓取,它就会不断用新字符串替换变量(msg.content)。我需要这样做,以便每当检测到消息时,它都会将该字符串添加到变量中并不断这样做,直到,假设计时器关闭。
解决方案
推荐阅读
- redis - 如何获取设置的redis db?
- c# - 如何在 Visual Studio 中使用 localDB(MDF) 在数据库中重新设置标识列
- javascript - 文件上传异步功能不等待
- node.js - 如何在节点js中循环下载大量文件?
- android - 如何将我的 fitbit 数据集成到我自己的 Android 应用程序中?
- android - Firebase Vision Labeler 返回不一致的结果
- angular - 如何在 Angular Project 中捆绑字体,使其不应该从互联网上下载?
- c# - 将 BEMCheckBox 绑定到 ViewModel 中的问题 - MvvmCross、Xamarin.iOS
- reactjs - 示例中的自定义自动完成不会在对话框中打开
- mysql - 在 Python 3 中使用变量为其名称创建表