Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions frontend/app/modals/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

import Logo from "@/app/asset/logo.svg";
import { OnboardingGradientBg } from "@/app/onboarding/onboarding-common";
import { atoms } from "@/app/store/global";
import { modalsModel } from "@/app/store/modalmodel";
import { RpcApi } from "@/app/store/wshclientapi";
import { TabRpcClient } from "@/app/store/wshrpcutil";
import { isDev } from "@/util/isdev";
import { fireAndForget } from "@/util/util";
import { useEffect, useState } from "react";
import { getApi } from "../store/global";
import { useAtomValue } from "jotai";
import { useEffect } from "react";
import { Modal } from "./modal";

interface AboutModalVProps {
Expand Down Expand Up @@ -84,9 +85,9 @@ const AboutModalV = ({ versionString, updaterChannel, onClose }: AboutModalVProp
AboutModalV.displayName = "AboutModalV";

const AboutModal = () => {
const [details] = useState(() => getApi().getAboutModalDetails());
const [updaterChannel] = useState(() => getApi().getUpdaterChannel());
const versionString = `${details.version} (${isDev() ? "dev-" : ""}${details.buildTime})`;
const fullConfig = useAtomValue(atoms.fullConfigAtom);
const versionString = `${fullConfig?.version ?? ""} (${isDev() ? "dev-" : ""}${fullConfig?.buildtime ?? ""})`;
const updaterChannel = fullConfig?.settings?.["autoupdate:channel"] ?? "latest";

useEffect(() => {
fireAndForget(async () => {
Expand Down
3 changes: 0 additions & 3 deletions frontend/app/store/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ export class BlockServiceType {
SaveTerminalState(blockId: string, state: string, stateType: string, ptyOffset: number, termSize: TermSize): Promise<void> {
return callBackendService(this?.waveEnv, "block", "SaveTerminalState", Array.from(arguments))
}
SaveWaveAiData(arg2: string, arg3: WaveAIPromptMessageType[]): Promise<void> {
return callBackendService(this?.waveEnv, "block", "SaveWaveAiData", Array.from(arguments))
}
}

export const BlockService = new BlockServiceType();
Expand Down
6 changes: 0 additions & 6 deletions frontend/app/store/wshclientapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,12 +924,6 @@ export class RpcApiType {
return client.wshRpcStream("streamtest", null, opts);
}

// command "streamwaveai" [responsestream]
StreamWaveAiCommand(client: WshClient, data: WaveAIStreamRequest, opts?: RpcOpts): AsyncGenerator<WaveAIPacketType, void, boolean> {
if (this.mockClient) return this.mockClient.mockWshRpcStream(client, "streamwaveai", data, opts);
return client.wshRpcStream("streamwaveai", data, opts);
}

// command "termgetscrollbacklines" [call]
TermGetScrollbackLinesCommand(client: WshClient, data: CommandTermGetScrollbackLinesData, opts?: RpcOpts): Promise<CommandTermGetScrollbackLinesRtnData> {
if (this.mockClient) return this.mockClient.mockWshRpcCall(client, "termgetscrollbacklines", data, opts);
Expand Down
49 changes: 2 additions & 47 deletions frontend/types/gotypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,8 @@ declare global {
bookmarks: {[key: string]: WebBookmark};
waveai: {[key: string]: AIModeConfigType};
configerrors: ConfigError[];
version: string;
buildtime: string;
};

// waveobj.Job
Expand Down Expand Up @@ -2009,53 +2011,6 @@ declare global {
fullconfig: FullConfigType;
};

// wshrpc.WaveAIOptsType
type WaveAIOptsType = {
model: string;
apitype?: string;
apitoken: string;
orgid?: string;
apiversion?: string;
baseurl?: string;
proxyurl?: string;
maxtokens?: number;
maxchoices?: number;
timeoutms?: number;
};

// wshrpc.WaveAIPacketType
type WaveAIPacketType = {
type: string;
model?: string;
created?: number;
finish_reason?: string;
usage?: WaveAIUsageType;
index?: number;
text?: string;
error?: string;
};

// wshrpc.WaveAIPromptMessageType
type WaveAIPromptMessageType = {
role: string;
content: string;
name?: string;
};

// wshrpc.WaveAIStreamRequest
type WaveAIStreamRequest = {
clientid?: string;
opts: WaveAIOptsType;
prompt: WaveAIPromptMessageType[];
};

// wshrpc.WaveAIUsageType
type WaveAIUsageType = {
prompt_tokens?: number;
completion_tokens?: number;
total_tokens?: number;
};


// filestore.WaveFile
type WaveFile = {
Expand Down
23 changes: 0 additions & 23 deletions pkg/service/blockservice/blockservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package blockservice

import (
"context"
"encoding/json"
"fmt"
"time"

Expand Down Expand Up @@ -68,28 +67,6 @@ func (bs *BlockService) SaveTerminalState(ctx context.Context, blockId string, s
return nil
}

func (bs *BlockService) SaveWaveAiData(ctx context.Context, blockId string, history []wshrpc.WaveAIPromptMessageType) error {
block, err := wstore.DBMustGet[*waveobj.Block](ctx, blockId)
if err != nil {
return err
}
viewName := block.Meta.GetString(waveobj.MetaKey_View, "")
if viewName != "waveai" {
return fmt.Errorf("invalid view type: %s", viewName)
}
historyBytes, err := json.Marshal(history)
if err != nil {
return fmt.Errorf("unable to serialize ai history: %v", err)
}
// ignore MakeFile error (already exists is ok)
filestore.WFS.MakeFile(ctx, blockId, "aidata", nil, wshrpc.FileOpts{})
err = filestore.WFS.WriteFile(ctx, blockId, "aidata", historyBytes)
if err != nil {
return fmt.Errorf("cannot save terminal state: %w", err)
}
return nil
}

func (*BlockService) CleanupOrphanedBlocks_Meta() tsgenmeta.MethodMeta {
return tsgenmeta.MethodMeta{
Desc: "queue a layout action to cleanup orphaned blocks in the tab",
Expand Down
Loading
Loading