From a7606b83635dfd3bd2bd2288f9c0ab76b97e5d64 Mon Sep 17 00:00:00 2001 From: sawka Date: Wed, 28 Aug 2024 12:05:29 -0700 Subject: [PATCH] update visuals to say gpt-4o-mini --- frontend/app/view/helpview/helpview.tsx | 2 +- frontend/app/view/waveai/waveai.tsx | 11 +++++++++-- pkg/waveai/waveai.go | 2 +- pkg/wconfig/defaultconfig/settings.json | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/app/view/helpview/helpview.tsx b/frontend/app/view/helpview/helpview.tsx index 02a585329..e4e9211b3 100644 --- a/frontend/app/view/helpview/helpview.tsx +++ b/frontend/app/view/helpview/helpview.tsx @@ -98,7 +98,7 @@ You can also exit without saving by pressing \`Cmd + r\`. ### AI #### How to Ask an LLM a Question -Asking a question is as simple as typing a message in the prompt and pressing enter. By default, we forward messages to the *gpt-3.5-turbo* model through our server. +Asking a question is as simple as typing a message in the prompt and pressing enter. By default, we forward messages to the *gpt-4o-mini* model through our server. #### How To Change The Model See *settings help* for more info on how to configure your model. diff --git a/frontend/app/view/waveai/waveai.tsx b/frontend/app/view/waveai/waveai.tsx index e9c9fdf1f..3e73028df 100644 --- a/frontend/app/view/waveai/waveai.tsx +++ b/frontend/app/view/waveai/waveai.tsx @@ -6,6 +6,7 @@ import { TypingIndicator } from "@/app/element/typingindicator"; import { WOS, atoms, fetchWaveFile, getUserName, globalStore } from "@/store/global"; import * as services from "@/store/services"; import { WshServer } from "@/store/wshserver"; +import * as util from "@/util/util"; import * as jotai from "jotai"; import type { OverlayScrollbars } from "overlayscrollbars"; import { OverlayScrollbarsComponent, OverlayScrollbarsComponentRef } from "overlayscrollbars-react"; @@ -104,10 +105,16 @@ export class WaveAiModel implements ViewModel { }, 1500); }); this.viewText = jotai.atom((get) => { + const settings = get(atoms.settingsAtom); + const isCloud = util.isBlank(settings?.["ai:apitoken"]) && util.isBlank(settings?.["ai:baseurl"]); + let modelText = "gpt-4o-mini"; + if (!isCloud && !util.isBlank(settings?.["ai:model"])) { + modelText = settings["ai:model"]; + } const viewTextChildren: HeaderElem[] = [ { elemtype: "text", - text: get(atoms.settingsAtom)["ai:model"] ?? "gpt-3.5-turbo", + text: modelText, }, ]; return viewTextChildren; @@ -174,7 +181,7 @@ export class WaveAiModel implements ViewModel { opts: opts, prompt: [...history, newPrompt], }; - const aiGen = WshServer.StreamWaveAiCommand(beMsg); + const aiGen = WshServer.StreamWaveAiCommand(beMsg, { timeout: 60000 }); let fullMsg = ""; for await (const msg of aiGen) { fullMsg += msg.text ?? ""; diff --git a/pkg/waveai/waveai.go b/pkg/waveai/waveai.go index 739cc2c85..093684e39 100644 --- a/pkg/waveai/waveai.go +++ b/pkg/waveai/waveai.go @@ -82,7 +82,7 @@ func GetWSEndpoint() string { } const DefaultMaxTokens = 1000 -const DefaultModel = "gpt-3.5-turbo" +const DefaultModel = "gpt-4o-mini" const DefaultStreamChanSize = 10 const PCloudWSEndpoint = "wss://wsapi.waveterm.dev/" const PCloudWSEndpointVarName = "PCLOUD_WS_ENDPOINT" diff --git a/pkg/wconfig/defaultconfig/settings.json b/pkg/wconfig/defaultconfig/settings.json index d5813dbef..414b3c966 100644 --- a/pkg/wconfig/defaultconfig/settings.json +++ b/pkg/wconfig/defaultconfig/settings.json @@ -1,5 +1,5 @@ { - "ai:model": "gpt-3.5-turbo", + "ai:model": "gpt-4o-mini", "ai:maxtokens": 1000, "ai:timeoutms": 10000, "autoupdate:enabled": true,