feat: v0.5.0 - provider icon actions, duplicate & connectivity test, dashboard chart fixes
- ProviderList: icon buttons (edit/copy/test/delete) via lucide-react, speed-test badge before enable/switch button - Duplicate provider: deep-copy provider + models as xxx-copy - test_connectivity command (cc-switch semantics: GET base_url, any HTTP response = reachable), latency badge green/orange/red, auto-dismiss 6s - Dashboard: daily bars anchored to panel bottom, Card flex height fix (heatmap stays content-height)
This commit is contained in:
1 parent
6b172914be
commit
b1d137f072
12 files changed
+232
-12
No files matched your search
+34
@@ -205,6 +205,39 @@ export default function App() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleDuplicateProvider = async (name: string) => {
|
||||
updateConfig((cfg) => {
|
||||
const src = cfg.providers[name];
|
||||
if (!src) return cfg;
|
||||
let newName = `${name}-copy`;
|
||||
let n = 2;
|
||||
while (cfg.providers[newName]) {
|
||||
newName = `${name}-copy-${n}`;
|
||||
n++;
|
||||
}
|
||||
// Clone the provider (deactivated, clear its remembered default model
|
||||
// since the model aliases will be re-keyed to the new name below).
|
||||
const copied = setProviderDefaultModel(
|
||||
{ ...src, name: newName, active: false },
|
||||
null
|
||||
);
|
||||
const providers = { ...cfg.providers, [newName]: copied };
|
||||
// Re-key this provider's models to the new provider name so the copy
|
||||
// has its own independent model set.
|
||||
const models = { ...cfg.models };
|
||||
for (const [alias, m] of Object.entries(cfg.models)) {
|
||||
if (m.provider === name) {
|
||||
const newAlias = newName + alias.slice(name.length);
|
||||
models[newAlias] = { ...m, alias: newAlias, provider: newName };
|
||||
}
|
||||
}
|
||||
return { ...cfg, providers, models };
|
||||
});
|
||||
await save();
|
||||
setSwitchMessage(t("copiedProvider", { name: `${name}-copy` }));
|
||||
setTimeout(() => setSwitchMessage(null), 3000);
|
||||
};
|
||||
|
||||
const handleSetDefaultModel = (alias: string) => {
|
||||
updateConfig((cfg) => {
|
||||
const model = cfg.models[alias];
|
||||
@@ -458,6 +491,7 @@ export default function App() {
|
||||
setView("edit");
|
||||
}}
|
||||
onDelete={handleDeleteProvider}
|
||||
onDuplicate={handleDuplicateProvider}
|
||||
onAdd={handleAddProvider}
|
||||
onSwitchProvider={handleSwitchProvider}
|
||||
agent={agent}
|
||||
|
||||
Reference in new issue
Block a user