59bb7fbc12
This is once again a huge commit, but its mostly performance improvements along with some bug fixes and refactoring. It also includes changes to the theming systems. I'm still not 100% happy with the theming system, but its better than before. Model fetching has been dramatically improved! Nearly all the important computation and pre-processing has been moved to the server. This has also somehow fixed the way model details are loaded, which was causing many models to be missing their details despite models.dev having them. The markdown renderer has once again been changed, but I'm mostly certain that this is the last time major changes will be made to it. The renderer is not spamming components, bloating memory usage, and its not using a bug prone custom written chunking system. There's also a lot more that I haven't mentioned and honestly forgot. I need to get better commit hygiene tbh.
55 lines
2.1 KiB
Vue
55 lines
2.1 KiB
Vue
<script setup lang="ts">
|
|
const { agents, unsubscribe, createAgent } = await useAgents();
|
|
const agentsOpen = ref(true);
|
|
const creatingAgent = ref(false);
|
|
|
|
const toggleAgentsList = () => {
|
|
agentsOpen.value = !agentsOpen.value;
|
|
};
|
|
|
|
const newAgent = async () => {
|
|
creatingAgent.value = true;
|
|
try {
|
|
const agent = await createAgent();
|
|
if (agent) return navigateTo(`/agent/${agent.id}`);
|
|
} finally {
|
|
creatingAgent.value = false;
|
|
}
|
|
};
|
|
|
|
onUnmounted(() => unsubscribe?.());
|
|
</script>
|
|
|
|
<template>
|
|
<nav class="flex flex-col gap-1">
|
|
<SidenavItem name="Search" icon="mynaui:search" />
|
|
<SidenavItem to="/" name="Home" icon="mynaui:home" />
|
|
|
|
<!-- Header Toggle -->
|
|
<button
|
|
class="flex items-center justify-between gap-2 px-2 py-2 rounded-lg hover:bg-[var(--color-hover)] transition-colors w-full"
|
|
@click="toggleAgentsList">
|
|
<span class="text-sm">Agents</span>
|
|
<Icon name="mynaui:chevron-down" class="w-4 h-4 transition-transform duration-200"
|
|
:class="{ '-rotate-90': !agentsOpen }" />
|
|
</button>
|
|
|
|
<!-- Animated Section -->
|
|
<Collapsible :is-open="agentsOpen">
|
|
<div class="mt-1 gap-1 flex flex-col transform-origin-top pt-1 pb-1 px-1">
|
|
<button @click="newAgent" :disabled="creatingAgent"
|
|
class="flex items-center gap-2 px-1 h-9 shrink-0 rounded-lg text-sm text-[var(--text-secondary)] hover:bg-[var(--color-hover)] transition-colors disabled:opacity-50 w-full">
|
|
<div class="h-7 w-7 flex items-center justify-center">
|
|
<Icon v-if="creatingAgent" class="text-4.5" name="svg-spinners:ring-resize" />
|
|
<Icon v-else class="text-4.5" name="mynaui:plus" />
|
|
</div>
|
|
<span>New Agent</span>
|
|
</button>
|
|
|
|
<SidenavItem v-for="agent in agents" :key="agent.id" :to="`/agent/${agent.id}`" :name="agent.name"
|
|
icon="mynaui:check-hexagon" />
|
|
</div>
|
|
</Collapsible>
|
|
</nav>
|
|
</template>
|