Merge branch 'main' into patch-1

This commit is contained in:
end-4
2024-03-24 09:16:29 +07:00
committed by GitHub
38 changed files with 879 additions and 448 deletions
+10 -7
View File
@@ -192,6 +192,9 @@ class GeminiService extends Service {
this._usingHistory = value;
}
get safe() { return this._safe }
set safe(value) { this._safe = value; }
get temperature() { return this._temperature }
set temperature(value) { this._temperature = value; }
@@ -282,13 +285,13 @@ class GeminiService extends Service {
const body =
{
"contents": this._messages.map(msg => { let m = { role: msg.role, parts: msg.parts }; return m; }),
// "safetySettings": [
// { category: "HARM_CATEGORY_DEROGATORY", threshold: "BLOCK_NONE", },
// { category: "HARM_CATEGORY_HARASSMENT", threshold: "BLOCK_NONE", },
// { category: "HARM_CATEGORY_HATE_SPEECH", threshold: "BLOCK_NONE", },
// { category: "HARM_CATEGORY_SEXUALLY_EXPLICIT", threshold: "BLOCK_NONE", },
// { category: "HARM_CATEGORY_UNSPECIFIED", threshold: "BLOCK_NONE", },
// ],
"safetySettings": this._safe ? [] : [
// { category: "HARM_CATEGORY_DEROGATORY", threshold: "BLOCK_NONE", },
{ category: "HARM_CATEGORY_HARASSMENT", threshold: "BLOCK_NONE", },
{ category: "HARM_CATEGORY_HATE_SPEECH", threshold: "BLOCK_NONE", },
{ category: "HARM_CATEGORY_SEXUALLY_EXPLICIT", threshold: "BLOCK_NONE", },
// { category: "HARM_CATEGORY_UNSPECIFIED", threshold: "BLOCK_NONE", },
],
"generationConfig": {
"temperature": this._temperature,
},