Add support for JSON values in additionalParams
This commit is contained in:
@@ -117,7 +117,7 @@ export const languageEnglish = {
|
|||||||
requestretrys: "This option is used to set the number of request retrys when request fails.",
|
requestretrys: "This option is used to set the number of request retrys when request fails.",
|
||||||
emotionPrompt: "This option is used to set the prompt that is used to detect emotion. if it is blank, it will use the default prompt.",
|
emotionPrompt: "This option is used to set the prompt that is used to detect emotion. if it is blank, it will use the default prompt.",
|
||||||
removePunctuationHypa: "If enabled, it will remove punctuation before executing HypaMemory.",
|
removePunctuationHypa: "If enabled, it will remove punctuation before executing HypaMemory.",
|
||||||
additionalParams: "Additional parameters that would be added to the request body. if you want to exclude some parameters, you can put `{{none}}` to the value. if you want to add a header instead of body, you can put `header::` in front of the key like `header::Authorization`.",
|
additionalParams: "Additional parameters that would be added to the request body. if you want to exclude some parameters, you can put `{{none}}` to the value. if you want to add a header instead of body, you can put `header::` in front of the key like `header::Authorization`. if you want value as json, you can put `json::` in front of the value like `json::{\"key\":\"value\"}`. otherwise, type of the value would be determined automatically.",
|
||||||
},
|
},
|
||||||
setup: {
|
setup: {
|
||||||
chooseProvider: "Choose AI Provider",
|
chooseProvider: "Choose AI Provider",
|
||||||
|
|||||||
@@ -631,10 +631,13 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
key = key.replace('header::', '')
|
key = key.replace('header::', '')
|
||||||
headers[key] = value
|
headers[key] = value
|
||||||
}
|
}
|
||||||
|
else if(value.startsWith('json::')){
|
||||||
|
value = value.replace('json::', '')
|
||||||
|
try {
|
||||||
|
body[key] = JSON.parse(value)
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
else if(isNaN(parseFloat(value))){
|
else if(isNaN(parseFloat(value))){
|
||||||
if(value.startsWith('"') && value.endsWith('"')){
|
|
||||||
value = value.slice(1, -1)
|
|
||||||
}
|
|
||||||
body[key] = value
|
body[key] = value
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
Reference in New Issue
Block a user