Skip to content

Commit eb93169

Browse files
Copilotsawka
andcommitted
Refine deprecated waveai layout and remove ai default widget
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com> Agent-Logs-Url: https://github.com/wavetermdev/waveterm/sessions/e9060c7d-7837-4f4b-b480-7e4a89d84c81
1 parent f0a1018 commit eb93169

4 files changed

Lines changed: 11 additions & 41 deletions

File tree

frontend/app/view/waveai/waveai.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ function WaveAiDeprecatedView() {
2222
}, []);
2323

2424
return (
25-
<div className="flex h-full items-center justify-center p-6">
26-
<div className="flex w-full max-w-[680px] flex-col items-center rounded-xl border border-border bg-panel px-8 py-10 text-center shadow-md">
27-
<div className="mb-4 flex size-16 items-center justify-center rounded-full bg-accent/15 text-accent">
28-
<i className="fa-sharp fa-solid fa-sparkles text-3xl" />
29-
</div>
25+
<div className="flex h-full w-full flex-col px-6 text-center">
26+
<div className="flex-[4]" />
27+
<div className="mx-auto flex w-full max-w-[760px] flex-col items-center">
3028
<h2 className="text-xl font-semibold text-primary">This legacy Wave AI block is no longer supported</h2>
3129
<p className="mt-3 text-sm leading-6 text-secondary">
3230
This older AI widget has been retired. Please use the modern Wave AI panel for AI chats, terminal
@@ -36,6 +34,7 @@ function WaveAiDeprecatedView() {
3634
Open Wave AI panel
3735
</Button>
3836
</div>
37+
<div className="flex-[6]" />
3938
</div>
4039
);
4140
}

frontend/app/workspace/widgets.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,20 +373,14 @@ const Widgets = memo(() => {
373373
const fullConfig = useAtomValue(env.atoms.fullConfigAtom);
374374
const hasConfigErrors = useAtomValue(env.atoms.hasConfigErrors);
375375
const workspaceId = useAtomValue(env.atoms.workspaceId);
376-
const hasCustomAIPresets = useAtomValue(env.atoms.hasCustomAIPresetsAtom);
377376
const [mode, setMode] = useState<"normal" | "compact" | "supercompact">("normal");
378377
const containerRef = useRef<HTMLDivElement>(null);
379378
const measurementRef = useRef<HTMLDivElement>(null);
380379

381380
const featureWaveAppBuilder = fullConfig?.settings?.["feature:waveappbuilder"] ?? false;
382381
const widgetsMap = fullConfig?.widgets ?? {};
383382
const filteredWidgets = Object.fromEntries(
384-
Object.entries(widgetsMap).filter(([key, widget]) => {
385-
if (!hasCustomAIPresets && key === "defwidget@ai") {
386-
return false;
387-
}
388-
return shouldIncludeWidgetForWorkspace(widget, workspaceId);
389-
})
383+
Object.entries(widgetsMap).filter(([_key, widget]) => shouldIncludeWidgetForWorkspace(widget, workspaceId))
390384
);
391385
const widgets = sortByDisplayOrder(filteredWidgets);
392386

frontend/preview/previews/widgets.preview.tsx

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,20 @@ const mockWidgets: { [key: string]: WidgetConfigType } = {
5959
"display:order": 2,
6060
blockdef: { meta: { view: "web", url: "https://waveterm.dev" } },
6161
},
62-
"defwidget@ai": {
63-
icon: "sparkles",
64-
color: "#a78bfa",
65-
label: "AI",
66-
description: "Open Wave AI",
67-
"display:order": 3,
68-
blockdef: { meta: { view: "waveai" } },
69-
},
7062
"defwidget@files": {
7163
icon: "folder",
7264
color: "#fbbf24",
7365
label: "Files",
7466
description: "Open file browser",
75-
"display:order": 4,
67+
"display:order": 3,
7668
blockdef: { meta: { view: "preview", connection: "local" } },
7769
},
7870
"defwidget@sysinfo": {
7971
icon: "chart-line",
8072
color: "#34d399",
8173
label: "Sysinfo",
8274
description: "Open system info",
83-
"display:order": 5,
75+
"display:order": 4,
8476
blockdef: { meta: { view: "sysinfo" } },
8577
},
8678
};
@@ -90,7 +82,6 @@ const fullConfigAtom = atom<FullConfigType>({ settings: {}, widgets: mockWidgets
9082
function makeWidgetsEnv(
9183
baseEnv: WaveEnv,
9284
isDev: boolean,
93-
hasCustomAIPresets: boolean,
9485
apps?: AppInfo[],
9586
atomOverrides?: Partial<GlobalAtomsType>
9687
) {
@@ -99,7 +90,6 @@ function makeWidgetsEnv(
9990
rpc: { ListAllAppsCommand: () => Promise.resolve(apps ?? []) },
10091
atoms: {
10192
fullConfigAtom,
102-
hasCustomAIPresetsAtom: atom(hasCustomAIPresets),
10393
...atomOverrides,
10494
},
10595
});
@@ -108,20 +98,18 @@ function makeWidgetsEnv(
10898
function WidgetsScenario({
10999
label,
110100
isDev = false,
111-
hasCustomAIPresets = true,
112101
height,
113102
apps,
114103
}: {
115104
label: string;
116105
isDev?: boolean;
117-
hasCustomAIPresets?: boolean;
118106
height?: number;
119107
apps?: AppInfo[];
120108
}) {
121109
const baseEnv = useWaveEnv();
122110
const envRef = useRef<WaveEnv>(null);
123111
if (envRef.current == null) {
124-
envRef.current = makeWidgetsEnv(baseEnv, isDev, hasCustomAIPresets, apps, {
112+
envRef.current = makeWidgetsEnv(baseEnv, isDev, apps, {
125113
hasConfigErrors: hasConfigErrorsAtom,
126114
});
127115
}
@@ -149,7 +137,7 @@ function WidgetsResizable({ isDev }: { isDev: boolean }) {
149137
const baseEnv = useWaveEnv();
150138
const envRef = useRef<WaveEnv>(null);
151139
if (envRef.current == null) {
152-
envRef.current = makeWidgetsEnv(baseEnv, isDev, true, mockApps, { hasConfigErrors: hasConfigErrorsAtom });
140+
envRef.current = makeWidgetsEnv(baseEnv, isDev, mockApps, { hasConfigErrors: hasConfigErrorsAtom });
153141
}
154142

155143
return (
@@ -224,8 +212,7 @@ export function WidgetsPreview() {
224212
<PreviewControls />
225213
<div key={mockVersion} className="flex flex-col gap-8">
226214
<div className="flex flex-row gap-8 items-start flex-wrap">
227-
<WidgetsScenario label="normal (with AI presets)" height={550} isDev={isDev} />
228-
<WidgetsScenario label="no custom AI presets" hasCustomAIPresets={false} height={550} isDev={isDev} />
215+
<WidgetsScenario label="normal" height={550} isDev={isDev} />
229216
<WidgetsScenario label="dev mode (apps button)" height={550} isDev={isDev} apps={mockApps} />
230217
<WidgetsScenario label="compact (200px)" height={200} isDev={isDev} apps={mockApps} />
231218
</div>

pkg/wconfig/defaultconfig/widgets.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,8 @@
3131
}
3232
}
3333
},
34-
"defwidget@ai": {
35-
"display:order": -2,
36-
"icon": "sparkles",
37-
"label": "ai",
38-
"blockdef": {
39-
"meta": {
40-
"view": "waveai"
41-
}
42-
}
43-
},
4434
"defwidget@sysinfo": {
45-
"display:order": -1,
35+
"display:order": -2,
4636
"icon": "chart-line",
4737
"label": "sysinfo",
4838
"blockdef": {

0 commit comments

Comments
 (0)