mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
added client settings and removed open ai wording (#474)
This commit is contained in:
parent
23fa1c3823
commit
b24c81182b
@ -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=""
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
1
src/types/custom.d.ts
vendored
1
src/types/custom.d.ts
vendored
@ -623,6 +623,7 @@ declare global {
|
||||
apitoken?: string;
|
||||
maxtokens?: number;
|
||||
maxchoices?: number;
|
||||
baseurl?: string;
|
||||
};
|
||||
|
||||
type PlaybookType = {
|
||||
|
Loading…
Reference in New Issue
Block a user