@chrysb/alphaclaw 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/public/js/app.js
CHANGED
|
@@ -27,6 +27,9 @@ import { Envars } from "./components/envars.js";
|
|
|
27
27
|
import { ToastContainer, showToast } from "./components/toast.js";
|
|
28
28
|
import { ChevronDownIcon } from "./components/icons.js";
|
|
29
29
|
const html = htm.bind(h);
|
|
30
|
+
const kUiTabStorageKey = "alphaclaw_ui_tab";
|
|
31
|
+
const kUiTabs = ["general", "models", "envars"];
|
|
32
|
+
const kDefaultUiTab = "general";
|
|
30
33
|
|
|
31
34
|
const GeneralTab = ({ onSwitchTab }) => {
|
|
32
35
|
const [googleKey, setGoogleKey] = useState(0);
|
|
@@ -269,7 +272,14 @@ const GeneralTab = ({ onSwitchTab }) => {
|
|
|
269
272
|
|
|
270
273
|
function App() {
|
|
271
274
|
const [onboarded, setOnboarded] = useState(null);
|
|
272
|
-
const [tab, setTab] = useState(
|
|
275
|
+
const [tab, setTab] = useState(() => {
|
|
276
|
+
try {
|
|
277
|
+
const savedTab = localStorage.getItem(kUiTabStorageKey);
|
|
278
|
+
return kUiTabs.includes(savedTab) ? savedTab : kDefaultUiTab;
|
|
279
|
+
} catch {
|
|
280
|
+
return kDefaultUiTab;
|
|
281
|
+
}
|
|
282
|
+
});
|
|
273
283
|
const [acVersion, setAcVersion] = useState(null);
|
|
274
284
|
const [acLatest, setAcLatest] = useState(null);
|
|
275
285
|
const [acHasUpdate, setAcHasUpdate] = useState(false);
|
|
@@ -282,6 +292,12 @@ function App() {
|
|
|
282
292
|
.catch(() => setOnboarded(false));
|
|
283
293
|
}, []);
|
|
284
294
|
|
|
295
|
+
useEffect(() => {
|
|
296
|
+
try {
|
|
297
|
+
localStorage.setItem(kUiTabStorageKey, tab);
|
|
298
|
+
} catch {}
|
|
299
|
+
}, [tab]);
|
|
300
|
+
|
|
285
301
|
useEffect(() => {
|
|
286
302
|
if (!onboarded) return;
|
|
287
303
|
let active = true;
|
|
@@ -332,11 +332,7 @@ export const Envars = () => {
|
|
|
332
332
|
<button
|
|
333
333
|
onclick=${handleSave}
|
|
334
334
|
disabled=${!dirty || saving || restartingGateway}
|
|
335
|
-
class="w-full text-sm font-medium px-4 py-2.5 rounded-xl transition-all
|
|
336
|
-
!saving &&
|
|
337
|
-
!restartingGateway
|
|
338
|
-
? "bg-white text-black hover:opacity-85"
|
|
339
|
-
: "bg-gray-800 text-gray-500 cursor-not-allowed"}"
|
|
335
|
+
class="w-full text-sm font-medium px-4 py-2.5 rounded-xl transition-all ac-btn-cyan"
|
|
340
336
|
>
|
|
341
337
|
${saving
|
|
342
338
|
? html`<span class="flex items-center justify-center gap-2">
|
|
@@ -357,7 +353,7 @@ export const Envars = () => {
|
|
|
357
353
|
</svg>
|
|
358
354
|
Saving...
|
|
359
355
|
</span>`
|
|
360
|
-
: "Save
|
|
356
|
+
: "Save changes"}
|
|
361
357
|
</button>
|
|
362
358
|
</div>
|
|
363
359
|
`;
|
|
@@ -320,7 +320,7 @@ export const Models = () => {
|
|
|
320
320
|
? html`
|
|
321
321
|
<button
|
|
322
322
|
onclick=${startCodexAuth}
|
|
323
|
-
class="text-xs font-medium px-3 py-1.5 rounded-lg
|
|
323
|
+
class="text-xs font-medium px-3 py-1.5 rounded-lg ac-btn-cyan"
|
|
324
324
|
>
|
|
325
325
|
Connect Codex OAuth
|
|
326
326
|
</button>
|
|
@@ -357,7 +357,7 @@ export const Models = () => {
|
|
|
357
357
|
<button
|
|
358
358
|
onclick=${completeCodexAuth}
|
|
359
359
|
disabled=${!codexManualInput.trim() || codexExchanging}
|
|
360
|
-
class="text-xs font-medium px-3 py-1.5 rounded-lg
|
|
360
|
+
class="text-xs font-medium px-3 py-1.5 rounded-lg ac-btn-cyan"
|
|
361
361
|
>
|
|
362
362
|
${codexExchanging ? "Completing..." : "Complete Codex OAuth"}
|
|
363
363
|
</button>
|
|
@@ -442,9 +442,7 @@ export const Models = () => {
|
|
|
442
442
|
<button
|
|
443
443
|
onclick=${saveChanges}
|
|
444
444
|
disabled=${!canSaveChanges}
|
|
445
|
-
class="w-full text-sm font-medium px-4 py-2.5 rounded-xl transition-all
|
|
446
|
-
? "bg-white text-black hover:opacity-85"
|
|
447
|
-
: "bg-gray-800 text-gray-500 cursor-not-allowed"}"
|
|
445
|
+
class="w-full text-sm font-medium px-4 py-2.5 rounded-xl transition-all ac-btn-cyan"
|
|
448
446
|
>
|
|
449
447
|
${savingChanges ? "Saving..." : "Save changes"}
|
|
450
448
|
</button>
|
|
@@ -110,7 +110,7 @@ export const WelcomeFormStep = ({
|
|
|
110
110
|
onclick=${startCodexAuth}
|
|
111
111
|
class="text-xs font-medium px-3 py-1.5 rounded-lg ${codexStatus.connected
|
|
112
112
|
? "border border-border text-gray-300 hover:border-gray-500"
|
|
113
|
-
: "
|
|
113
|
+
: "ac-btn-cyan"}"
|
|
114
114
|
>
|
|
115
115
|
${codexStatus.connected ? "Reconnect Codex" : "Connect Codex OAuth"}
|
|
116
116
|
</button>
|
|
@@ -148,10 +148,7 @@ export const WelcomeFormStep = ({
|
|
|
148
148
|
type="button"
|
|
149
149
|
onclick=${completeCodexAuth}
|
|
150
150
|
disabled=${!codexManualInput.trim() || codexExchanging}
|
|
151
|
-
class="text-xs font-medium px-3 py-1.5 rounded-lg
|
|
152
|
-
codexExchanging
|
|
153
|
-
? "bg-gray-700 text-gray-400 cursor-not-allowed"
|
|
154
|
-
: "bg-white text-black hover:opacity-85"}"
|
|
151
|
+
class="text-xs font-medium px-3 py-1.5 rounded-lg ac-btn-cyan"
|
|
155
152
|
>
|
|
156
153
|
${codexExchanging ? "Completing..." : "Complete Codex OAuth"}
|
|
157
154
|
</button>
|
|
@@ -224,7 +224,9 @@ export const Welcome = ({ onComplete }) => {
|
|
|
224
224
|
|
|
225
225
|
try {
|
|
226
226
|
const vars = Object.entries(vals)
|
|
227
|
-
.filter(
|
|
227
|
+
.filter(
|
|
228
|
+
([key]) => key !== "MODEL_KEY" && !String(key || "").startsWith("_"),
|
|
229
|
+
)
|
|
228
230
|
.filter(([, v]) => v)
|
|
229
231
|
.map(([key, value]) => ({ key, value }));
|
|
230
232
|
const result = await runOnboard(vars, vals.MODEL_KEY);
|