Skip to content

Commit

Permalink
feat: Charlie - realtime API driven agent
Browse files Browse the repository at this point in the history
  • Loading branch information
sugarforever committed Dec 20, 2024
1 parent 63aae99 commit c5df0e3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/Charlie.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function configureData() {
}
}
.animate-wave {
:deep(.animate-wave) {
animation: wave 1s ease-in-out infinite;
}
</style>
29 changes: 29 additions & 0 deletions pages/instructions/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,34 @@ onMounted(() => {
method: 'POST',
body: args
})
await loadInstructions(true)
return { success: true }
} catch (error) {
return { success: false, error: error.message }
}
}
})
registerTool({
type: 'function',
name: 'deleteInstruction',
description: 'Deletes an instruction by name',
parameters: {
type: 'object',
properties: {
name: { type: 'string', description: 'Name of the instruction' }
}
},
handler: async (args) => {
try {
const instruction = instructions.value.find(i => i.name === args.name)
if (!instruction) {
return { success: false, error: 'Instruction not found' }
}
await $fetchWithAuth(`/api/instruction/${instruction.id}`, {
method: "DELETE",
})
await loadInstructions()
return { success: true }
} catch (error) {
Expand All @@ -82,6 +110,7 @@ onMounted(() => {
onUnmounted(() => {
unregisterTool('listInstructions')
unregisterTool('createInstruction')
unregisterTool('deleteInstruction')
})
const ui = {
Expand Down

0 comments on commit c5df0e3

Please sign in to comment.