File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 167
167
"value" : " "
168
168
}
169
169
]
170
+ },
171
+ {
172
+ "identifier" : " temperature" ,
173
+ "type" : " text" ,
174
+ "title" : " 温度" ,
175
+ "defaultValue" : " 0.2" ,
176
+ "desc" : " 可选项。温度值越高,生成的文本越随机。默认值为 0.2" ,
177
+ "textConfig" : {
178
+ "type" : " visible" ,
179
+ "placeholderText" : " 0.2"
180
+ }
170
181
}
171
182
]
172
183
}
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ function generatePrompts(query) {
77
77
* }}
78
78
*/
79
79
function buildRequestBody ( model , query ) {
80
- let { customSystemPrompt, customUserPrompt } = $option ;
80
+ let { customSystemPrompt, customUserPrompt, temperature } = $option ;
81
81
const { generatedSystemPrompt, generatedUserPrompt } = generatePrompts ( query ) ;
82
82
83
83
customSystemPrompt = replacePromptKeywords ( customSystemPrompt , query ) ;
@@ -86,9 +86,11 @@ function buildRequestBody(model, query) {
86
86
const systemPrompt = customSystemPrompt || generatedSystemPrompt ;
87
87
const userPrompt = customUserPrompt || generatedUserPrompt ;
88
88
89
+ const modelTemperature = Number ( temperature || 0.2 ) ;
90
+
89
91
const standardBody = {
90
92
model : model ,
91
- temperature : 0.2 ,
93
+ temperature : modelTemperature ,
92
94
max_tokens : 1000 ,
93
95
top_p : 1 ,
94
96
frequency_penalty : 1 ,
You can’t perform that action at this time.
0 commit comments