feat: support custom gemini pro params

This commit is contained in:
Fred Liang 2023-12-24 17:24:04 +08:00
parent 75057f9a91
commit 7c3dfb7bae
No known key found for this signature in database
GPG Key ID: 4DABDA85EF70EC71
2 changed files with 83 additions and 69 deletions

View File

@ -34,6 +34,15 @@ export class GeminiProApi implements LLMApi {
}; };
const requestPayload = { const requestPayload = {
contents: messages, contents: messages,
generationConfig: {
// stopSequences: [
// "Title"
// ],
temperature: modelConfig.temperature,
maxOutputTokens: modelConfig.max_tokens,
topP: modelConfig.top_p,
// "topK": modelConfig.top_k,
},
// stream: options.config.stream, // stream: options.config.stream,
// model: modelConfig.model, // model: modelConfig.model,
// temperature: modelConfig.temperature, // temperature: modelConfig.temperature,

View File

@ -91,6 +91,9 @@ export function ModelConfigList(props: {
} }
></input> ></input>
</ListItem> </ListItem>
{props.modelConfig.model === "gemini-pro" ? null : (
<>
<ListItem <ListItem
title={Locale.Settings.PresencePenalty.Title} title={Locale.Settings.PresencePenalty.Title}
subTitle={Locale.Settings.PresencePenalty.SubTitle} subTitle={Locale.Settings.PresencePenalty.SubTitle}
@ -143,7 +146,8 @@ export function ModelConfigList(props: {
onChange={(e) => onChange={(e) =>
props.updateConfig( props.updateConfig(
(config) => (config) =>
(config.enableInjectSystemPrompts = e.currentTarget.checked), (config.enableInjectSystemPrompts =
e.currentTarget.checked),
) )
} }
></input> ></input>
@ -163,7 +167,8 @@ export function ModelConfigList(props: {
} }
></input> ></input>
</ListItem> </ListItem>
</>
)}
<ListItem <ListItem
title={Locale.Settings.HistoryCount.Title} title={Locale.Settings.HistoryCount.Title}
subTitle={Locale.Settings.HistoryCount.SubTitle} subTitle={Locale.Settings.HistoryCount.SubTitle}