Allowing users to add their own init prompt and replace the default for their own session

This commit is contained in:
Raven Scott 2023-04-03 00:20:06 +02:00
parent 962c108eec
commit 5bbbcb7c08

View File

@ -19,9 +19,21 @@ module.exports = {
name: "create-session", name: "create-session",
description: "create a new session chat", description: "create a new session chat",
private: true, private: true,
options: [{
"name": "init-prompt",
"description": "A prompt you want to init the chat with, a default is used if not provided.",
"required": false,
"type": 3 // 6 is type USER
}],
run: async (client, interaction) => { run: async (client, interaction) => {
const file = './cache/' + interaction.user.id const file = './cache/' + interaction.user.id
if (!interaction.options._hoistedOptions[0]){
console.log("-- No init-prompt provided, using default --")
} else [
initPrompt = interaction.options._hoistedOptions[0].value
]
var req = unirest('POST', apiUrl + '?model=' + model + '&temperature=' + temperature + '&top_k=' + topK + '&top_p=' + topP + '&max_length=' + maxLength + '&context_window=' + contextWindow + '&repeat_last_n=' + repeatLastN + '&repeat_penalty=' + repeatPenalty + '&init_prompt=' + initPrompt + '&n_threads=' + nThreads) var req = unirest('POST', apiUrl + '?model=' + model + '&temperature=' + temperature + '&top_k=' + topK + '&top_p=' + topP + '&max_length=' + maxLength + '&context_window=' + contextWindow + '&repeat_last_n=' + repeatLastN + '&repeat_penalty=' + repeatPenalty + '&init_prompt=' + initPrompt + '&n_threads=' + nThreads)
.headers({ .headers({
'accept': 'application/json' 'accept': 'application/json'