fix: gemini api
This commit is contained in:
@@ -303,12 +303,19 @@ const genGemini = ({
|
|||||||
|
|
||||||
const userMsg = { role: "user", parts: [{ text: userPrompt }] };
|
const userMsg = { role: "user", parts: [{ text: userPrompt }] };
|
||||||
const body = {
|
const body = {
|
||||||
system_instruction: {
|
// system_instruction: {
|
||||||
parts: {
|
// parts: {
|
||||||
text: systemPrompt,
|
// text: systemPrompt,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
contents: [
|
||||||
|
{
|
||||||
|
role: "model",
|
||||||
|
parts: [{ text: systemPrompt }],
|
||||||
},
|
},
|
||||||
},
|
...hisMsgs,
|
||||||
contents: [...hisMsgs, userMsg],
|
userMsg,
|
||||||
|
],
|
||||||
generationConfig: {
|
generationConfig: {
|
||||||
maxOutputTokens: maxTokens,
|
maxOutputTokens: maxTokens,
|
||||||
temperature,
|
temperature,
|
||||||
|
|||||||
@@ -197,7 +197,6 @@ export class InputTranslator {
|
|||||||
text,
|
text,
|
||||||
fromLang,
|
fromLang,
|
||||||
toLang,
|
toLang,
|
||||||
apiSlug,
|
|
||||||
apiSetting,
|
apiSetting,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import {
|
|||||||
BUILTIN_PLACETAGS,
|
BUILTIN_PLACETAGS,
|
||||||
} from "../../config";
|
} from "../../config";
|
||||||
|
|
||||||
function TestButton({ apiSlug, api }) {
|
function TestButton({ api }) {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
const alert = useAlert();
|
const alert = useAlert();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -53,11 +53,10 @@ function TestButton({ apiSlug, api }) {
|
|||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const [text] = await apiTranslate({
|
const [text] = await apiTranslate({
|
||||||
apiSlug,
|
|
||||||
text: "hello world",
|
text: "hello world",
|
||||||
fromLang: "en",
|
fromLang: "en",
|
||||||
toLang: "zh-CN",
|
toLang: "zh-CN",
|
||||||
apiSetting: api,
|
apiSetting: { ...api },
|
||||||
useCache: false,
|
useCache: false,
|
||||||
});
|
});
|
||||||
if (!text) {
|
if (!text) {
|
||||||
@@ -691,7 +690,7 @@ function ApiFields({ apiSlug, isUserApi, deleteApi }) {
|
|||||||
>
|
>
|
||||||
{i18n("save")}
|
{i18n("save")}
|
||||||
</Button>
|
</Button>
|
||||||
<TestButton apiSlug={apiSlug} api={api} />
|
<TestButton api={api} />
|
||||||
<Button size="small" variant="outlined" onClick={handleReset}>
|
<Button size="small" variant="outlined" onClick={handleReset}>
|
||||||
{i18n("restore_default")}
|
{i18n("restore_default")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user