fix: update ai format
This commit is contained in:
@@ -352,18 +352,34 @@ const genGemini = ({
|
|||||||
text: systemPrompt,
|
text: systemPrompt,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
contents: {
|
contents: [{ role: "user", parts: [{ text: userPrompt }] }],
|
||||||
role: "user",
|
|
||||||
parts: {
|
|
||||||
text: userPrompt,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
generationConfig: {
|
generationConfig: {
|
||||||
maxOutputTokens: maxTokens,
|
maxOutputTokens: maxTokens,
|
||||||
temperature,
|
temperature,
|
||||||
// topP: 0.8,
|
// topP: 0.8,
|
||||||
// topK: 10,
|
// topK: 10,
|
||||||
},
|
},
|
||||||
|
// thinkingConfig: {
|
||||||
|
// thinkingBudget: 0,
|
||||||
|
// },
|
||||||
|
safetySettings: [
|
||||||
|
{
|
||||||
|
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_DANGEROUS_CONTENT",
|
||||||
|
threshold: "BLOCK_NONE",
|
||||||
|
},
|
||||||
|
],
|
||||||
...customBody,
|
...customBody,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -702,7 +718,7 @@ export const genTransReq = (translator, args) => {
|
|||||||
export const parseTransRes = (
|
export const parseTransRes = (
|
||||||
translator,
|
translator,
|
||||||
res,
|
res,
|
||||||
{ texts, from, to, resHook }
|
{ texts, from, to, resHook, thinkIgnore }
|
||||||
) => {
|
) => {
|
||||||
switch (translator) {
|
switch (translator) {
|
||||||
case OPT_TRANS_GOOGLE:
|
case OPT_TRANS_GOOGLE:
|
||||||
@@ -765,13 +781,12 @@ export const parseTransRes = (
|
|||||||
case OPT_TRANS_OLLAMA:
|
case OPT_TRANS_OLLAMA:
|
||||||
case OPT_TRANS_OLLAMA_2:
|
case OPT_TRANS_OLLAMA_2:
|
||||||
case OPT_TRANS_OLLAMA_3:
|
case OPT_TRANS_OLLAMA_3:
|
||||||
// const deepModels = thinkIgnore.split(",").filter((model) => model.trim());
|
let resText = res?.response ?? "";
|
||||||
// if (deepModels.some((model) => res?.model?.startsWith(model))) {
|
const deepModels = thinkIgnore.split(",").filter((model) => model.trim());
|
||||||
// trText = res?.response.replace(/<think>[\s\S]*<\/think>/i, "");
|
if (deepModels.some((model) => res?.model?.startsWith(model))) {
|
||||||
// } else {
|
resText = res?.response.replace(/<think>[\s\S]*<\/think>/i, "");
|
||||||
// trText = res?.response;
|
}
|
||||||
// }
|
return parseAIRes(resText);
|
||||||
return parseAIRes(res?.response ?? "");
|
|
||||||
case OPT_TRANS_CUSTOMIZE:
|
case OPT_TRANS_CUSTOMIZE:
|
||||||
case OPT_TRANS_CUSTOMIZE_2:
|
case OPT_TRANS_CUSTOMIZE_2:
|
||||||
case OPT_TRANS_CUSTOMIZE_3:
|
case OPT_TRANS_CUSTOMIZE_3:
|
||||||
|
|||||||
Reference in New Issue
Block a user