♻️ refactor: optimize state management, switch to @tanstack/vue-virtual, and improve performance

- Centralize `useAgents` and `useModels` state within the Nuxt app context to prevent data leaks and improve initialization.
- Migrate virtualization from `vue-virtual-scroller` to `@tanstack/vue-virtual` with new `RowVirtualizerFixed` and `RowVirtualizerDynamic` components.
- Upgrade Nuxt to v4.3.1 and remove `@vue-macros/nuxt`.
- Replace `big.js` with an optimized custom `lshDecimal` string manipulation logic for pricing calculations in the provider API.
- Implement automatic focus redirection in `ChatInput` to capture standard keyboard input.
- Refactor Sidenav and Settings components to utilize virtualization for long lists (topics, agents, models).
- Enhance theme colors and mobile experience. More work to come on both of these.
This commit is contained in:
Zoe
2026-02-23 15:56:10 +00:00
parent 59bb7fbc12
commit 6ee4087a29
42 changed files with 889 additions and 828 deletions
+5 -15
View File
@@ -1,18 +1,12 @@
<script setup lang="ts">
const { getAgent, unsubscribe: unsubscribeAgents } = await useAgents();
const { getAgent } = useAgents();
const triplit = useTriplitClient();
const route = useRoute();
const agent = computed(() => {
if (route.params.id === null || typeof route.params.id !== 'string') {
throw new Error('Invalid agent ID');
}
const agent = getAgent(route.params.id as string);
return getAgent(route.params.id)!;
});
// if (agent.value === undefined) navigateTo('/');
if (agent.value === undefined) navigateTo('/');
const handleInput = async (e: Event) => {
const target = e.target as HTMLInputElement;
@@ -20,7 +14,7 @@ const handleInput = async (e: Event) => {
return;
}
await triplit.update('agents', agent.value.id, { name: target.value });
await triplit.update('agents', agent.value!.id, { name: target.value });
};
const changeSystemPrompt = async (e: Event) => {
@@ -31,14 +25,10 @@ const changeSystemPrompt = async (e: Event) => {
value = undefined;
}
await triplit.update('agents', agent.value.id, {
await triplit.update('agents', agent.value!.id, {
systemPrompt: target.value,
});
};
onUnmounted(() => {
unsubscribeAgents?.();
});
</script>
<template>