added client settings and removed open ai wording (#474)

This commit is contained in:
Cole Lashley 2024-03-18 23:43:20 -07:00 committed by GitHub
parent 23fa1c3823
commit b24c81182b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 4 deletions

View File

@ -136,6 +136,12 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
commandRtnHandler(prtn, this.errorMessage);
}
@boundMethod
inlineUpdateOpenAIBaseURL(newBaseURL: string): void {
const prtn = GlobalCommandRunner.setClientOpenAISettings({ baseurl: newBaseURL });
commandRtnHandler(prtn, this.errorMessage);
}
@boundMethod
setErrorMessage(msg: string): void {
mobx.action(() => {
@ -255,7 +261,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
</div>
</div>
<div className="settings-field">
<div className="settings-label">OpenAI Token</div>
<div className="settings-label">AI Token</div>
<div className="settings-input">
<InlineSettingsTextEdit
placeholder=""
@ -268,7 +274,20 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
</div>
</div>
<div className="settings-field">
<div className="settings-label">OpenAI Model</div>
<div className="settings-label">AI Base URL</div>
<div className="settings-input">
<InlineSettingsTextEdit
placeholder=""
text={isBlank(openAIOpts.baseurl) ? "openai default" : openAIOpts.baseurl}
value={openAIOpts.baseurl ?? ""}
onChange={this.inlineUpdateOpenAIBaseURL}
maxLength={10}
showIcon={true}
/>
</div>
</div>
<div className="settings-field">
<div className="settings-label">AI Model</div>
<div className="settings-input">
<InlineSettingsTextEdit
placeholder="gpt-3.5-turbo"
@ -281,7 +300,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
</div>
</div>
<div className="settings-field">
<div className="settings-label">OpenAI MaxTokens</div>
<div className="settings-label">AI MaxTokens</div>
<div className="settings-input">
<InlineSettingsTextEdit
placeholder=""

View File

@ -373,7 +373,12 @@ class CommandRunner {
return GlobalModel.submitCommand("client", "set", null, kwargs, interactive);
}
setClientOpenAISettings(opts: { model?: string; apitoken?: string; maxtokens?: string }): Promise<CommandRtnType> {
setClientOpenAISettings(opts: {
model?: string;
apitoken?: string;
maxtokens?: string;
baseurl?: string;
}): Promise<CommandRtnType> {
let kwargs = {
nohist: "1",
};
@ -386,6 +391,9 @@ class CommandRunner {
if (opts.maxtokens != null) {
kwargs["openaimaxtokens"] = opts.maxtokens;
}
if (opts.baseurl != null) {
kwargs["openaibaseurl"] = opts.baseurl;
}
return GlobalModel.submitCommand("client", "set", null, kwargs, false);
}

View File

@ -623,6 +623,7 @@ declare global {
apitoken?: string;
maxtokens?: number;
maxchoices?: number;
baseurl?: string;
};
type PlaybookType = {