fall back to first agent if last used agent is not available
This commit is contained in:
parent
5fd833aa18
commit
d58004a864
1 changed files with 1 additions and 1 deletions
|
|
@ -57,7 +57,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
|
||||||
return agents()
|
return agents()
|
||||||
},
|
},
|
||||||
current() {
|
current() {
|
||||||
return agents().find((x) => x.name === agentStore.current)!
|
return agents().find((x) => x.name === agentStore.current) ?? agents()[0]
|
||||||
},
|
},
|
||||||
set(name: string) {
|
set(name: string) {
|
||||||
if (!agents().some((x) => x.name === name))
|
if (!agents().some((x) => x.name === name))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue