mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
fix api tools logic (#6144)
This commit is contained in:
@@ -87,10 +87,6 @@
|
||||
$effect(() => {
|
||||
aiChatManager.updateMode(untrack(() => aiChatManager.mode))
|
||||
})
|
||||
|
||||
$effect(() => {
|
||||
aiChatManager.loadApiTools()
|
||||
})
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
|
||||
@@ -89,13 +89,15 @@ class AIChatManager {
|
||||
|
||||
open = $derived(chatState.size > 0)
|
||||
|
||||
async loadApiTools() {
|
||||
if (this.apiTools.length === 0) {
|
||||
this.apiTools = await loadApiTools()
|
||||
if (this.mode === AIMode.NAVIGATOR) {
|
||||
this.tools = [this.changeModeTool, ...navigatorTools, ...this.apiTools]
|
||||
}
|
||||
}
|
||||
constructor() {
|
||||
loadApiTools()
|
||||
.then((tools) => {
|
||||
this.apiTools = tools
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Error loading api tools', err)
|
||||
this.apiTools = []
|
||||
})
|
||||
}
|
||||
|
||||
setAiChatInput(aiChatInput: AIChatInput | null) {
|
||||
|
||||
Reference in New Issue
Block a user