major agent refactoring: wiki knowledge base, no RAG, no Qdrant, no Ollama

This commit is contained in:
2026-04-21 21:03:24 -04:00
parent 7e4b54d701
commit 44a1688657
80 changed files with 2699 additions and 4267 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount, watch } from 'vue'
import { ref, computed, onMounted, onBeforeUnmount, watch } from 'vue'
import ChartView from './components/ChartView.vue'
import ChatPanel from './components/ChatPanel.vue'
import LoginScreen from './components/LoginScreen.vue'
@@ -20,44 +20,48 @@ const authError = ref<string>()
const isMobile = ref(false)
let stateSyncCleanup: (() => void) | null = null
// Horizontal split: chart width in pixels (initialized on mount)
// Horizontal split: chat width in pixels (fixed, anchored to right edge)
const CHART_MIN_PX = 300
const CHAT_MIN_PX = 240
const CHART_DEFAULT_RATIO = 0.62
const chartWidth = ref(0)
const CHAT_DEFAULT_RATIO = 0.38
const chatWidth = ref(0)
const windowWidth = ref(0)
let hDragStartX = 0
let hDragStartWidth = 0
function initChartWidth() {
chartWidth.value = Math.round(window.innerWidth * CHART_DEFAULT_RATIO)
const chartVisible = computed(() => windowWidth.value - chatWidth.value - 4 >= CHART_MIN_PX)
function initChatWidth() {
windowWidth.value = window.innerWidth
chatWidth.value = Math.round(window.innerWidth * CHAT_DEFAULT_RATIO)
}
function startHDrag(e: PointerEvent) {
e.preventDefault()
;(e.target as HTMLElement).setPointerCapture(e.pointerId)
hDragStartX = e.clientX
hDragStartWidth = chartWidth.value
hDragStartWidth = chatWidth.value
}
function onHDragMove(e: PointerEvent) {
if (!e.buttons) return
const delta = e.clientX - hDragStartX
const maxWidth = window.innerWidth - CHAT_MIN_PX - 4
chartWidth.value = Math.max(CHART_MIN_PX, Math.min(maxWidth, hDragStartWidth + delta))
// dragging right shrinks chat; dragging left grows chat
const delta = hDragStartX - e.clientX
const maxChatWidth = windowWidth.value - CHART_MIN_PX - 4
chatWidth.value = Math.max(CHAT_MIN_PX, Math.min(Math.max(maxChatWidth, CHAT_MIN_PX), hDragStartWidth + delta))
}
// Clamp chartWidth so chart + chat always fit within the window
function clampChartWidth() {
const maxWidth = window.innerWidth - CHAT_MIN_PX - 4
if (maxWidth >= CHART_MIN_PX) {
chartWidth.value = Math.max(CHART_MIN_PX, Math.min(maxWidth, chartWidth.value))
}
// Clamp chatWidth so chat stays within valid range on resize
function clampChatWidth() {
windowWidth.value = window.innerWidth
const maxChatWidth = windowWidth.value - CHART_MIN_PX - 4
chatWidth.value = Math.max(CHAT_MIN_PX, Math.min(Math.max(maxChatWidth, CHAT_MIN_PX), chatWidth.value))
}
// Check screen width for mobile layout
const checkMobile = () => {
isMobile.value = window.innerWidth < 768
if (!isMobile.value) clampChartWidth()
if (!isMobile.value) clampChatWidth()
}
const chartStore = useChartStore()
@@ -74,7 +78,7 @@ watch(isMobile, (mobile) => {
// Check if user is already authenticated on page load
onMounted(async () => {
initChartWidth()
initChatWidth()
checkMobile()
window.addEventListener('resize', checkMobile)
@@ -149,11 +153,11 @@ onBeforeUnmount(() => {
/>
<div v-else-if="!isMobile" class="desktop-layout">
<div class="top-area">
<div class="chart-panel" :style="{ width: chartWidth + 'px' }">
<div v-if="chartVisible" class="chart-panel">
<ChartView />
</div>
<div class="h-grabber" @pointerdown="startHDrag" @pointermove="onHDragMove" />
<div class="chat-panel">
<div v-if="chartVisible" class="h-grabber" @pointerdown="startHDrag" @pointermove="onHDragMove" />
<div class="chat-panel" :style="{ width: chatWidth + 'px' }">
<ChatPanel />
</div>
</div>
@@ -189,7 +193,8 @@ onBeforeUnmount(() => {
}
.chart-panel {
flex-shrink: 0;
flex: 1;
min-width: 0;
height: 100%;
overflow: hidden;
display: flex;
@@ -209,8 +214,7 @@ onBeforeUnmount(() => {
}
.chat-panel {
flex: 1;
min-width: 240px;
flex-shrink: 0;
height: 100%;
overflow: hidden;
display: flex;