* feat: restore group chat system with Socket.IO and SQLite persistence - GroupChatServer: Socket.IO server with room management, message history, typing indicators - SQLite storage for rooms, messages, and agent configuration - AgentClients: manages AI agent connections via socket.io-client, forwards @mentions to Hermes gateway - REST API: room CRUD, agent management, invite codes - Agent auto-restoration on server restart - Tests for all REST endpoints Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add context-engine design document for group chat compression Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: handle special-character session search * fix: keep unicode dotted session search on quoted FTS path * feat: add context engine and group chat frontend UI - Context engine: three-zone compression (head/tail/summary) with LLM summarization, incremental updates, TTL cache, and graceful degradation - Frontend: group chat page with Socket.IO client, room sidebar, message list, agent/member display, create/join-by-code modals - Integration: wire context engine into agent-clients before /v1/runs - Refactor ChatStorage to use global DB (getDb/ensureTable) with gc_ prefix - Add i18n keys for group chat to all 8 locales - Add sidebar nav entry and router for group chat page Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: remove leftover main branch code from merge conflict resolution The `isNumericQuery`, `hasUnsafeChars`, and `runLikeContentSearch` functions no longer exist — they were replaced by HEAD's `shouldUseLiteralContentSearch` and `runLiteralContentSearch`. This dead code block caused a TypeScript compile error after the merge. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: install missing socket.io dep and type ack params Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: enable WebSocket proxy and fix socket.io transport for group chat - Add ws: true to Vite proxy config so WebSocket upgrade requests are forwarded to the backend - Allow both polling and websocket transports on server and client (polling as fallback when WebSocket upgrade fails through proxy) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: separate socket.io path from REST routes for group chat socket.io was mounted at /api/hermes/group-chat which intercepted all REST requests to /api/hermes/group-chat/rooms etc, returning "Transport unknown". Changed socket.io path to /api/hermes/group-chat/ws to avoid conflicts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: improve group chat UI, agent management, and socket.io reliability - Redesign GroupChatPanel with Naive UI, stacked agent avatars, and popover management - Match GroupChatInput style with single chat input, add IME composition handling - Add agent add/remove per room with profile selection and duplicate prevention - Use @multiavatar for SVG avatar generation with caching - Decouple joinRoom from socket.io, use REST API for data loading - Switch socket.io to default path with /group-chat namespace to avoid proxy conflicts - Restore agent connections after server is listening - Add getRoomDetail REST endpoint and duplicate agent prevention (409) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: server-side @mention routing with context compression status and queue - Move @mention detection from agent socket listeners to server-side processMentions() - Add per-room processing lock to block mention dispatch during compression - Queue mentions during processing, drain only the latest when ready - Emit context_status events (compressing/replying/ready) to room via Socket.IO - Frontend displays compression status indicator above input - Token-based compression trigger (100k threshold) with CJK-aware estimation - Fix compressor type errors (countTokens parameter type) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: improve group chat profile handling and session sync Refine group chat room/session behavior with per-room compression controls, sidebar updates, and better stale session cleanup so multi-profile group chat state stays consistent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: group chat improvements — session lifecycle, typing recovery, mention highlighting - Fix cross-profile session deletion with deferred delete queue - Move saveSessionProfile to after gateway response confirmation - Replace all console.log with logger in group-chat modules - Add server-side typing/context_status state tracking for room rejoin - Fix @ mention popup position to follow cursor - Add @ mention highlighting (blue) in chat message content - Fix mention regex to match all occurrences after HTML tags - Enable esbuild minify and treeShaking - Move @multiavatar/multiavatar to devDependencies - Add i18n keys for group chat features - Update tests for new functionality Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: bump version to 0.4.5 and move @multiavatar to devDependencies Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Zhicheng Han <zhicheng.han@mathematik.uni-goettingen.de>
161 lines
5.3 KiB
Vue
161 lines
5.3 KiB
Vue
<script setup lang="ts">
|
|
import { ref, nextTick } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import { NInput, NButton, NSpace, NInputNumber, NCollapse, NCollapseItem } from 'naive-ui'
|
|
|
|
type InputLikeInstance = {
|
|
focus: () => void
|
|
}
|
|
|
|
const { t } = useI18n()
|
|
const emit = defineEmits<{
|
|
submit: [name: string, inviteCode: string, userName: string, description: string, compression: { triggerTokens: number; maxHistoryTokens: number; tailMessageCount: number }]
|
|
cancel: []
|
|
}>()
|
|
|
|
const roomName = ref('')
|
|
const inviteCode = ref('')
|
|
const userName = ref('')
|
|
const description = ref('')
|
|
const roomInput = ref<InputLikeInstance | null>(null)
|
|
|
|
const compression = ref({
|
|
triggerTokens: 100000,
|
|
maxHistoryTokens: 32000,
|
|
tailMessageCount: 20,
|
|
})
|
|
|
|
function generateCode(): string {
|
|
const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'
|
|
let code = ''
|
|
for (let i = 0; i < 6; i++) {
|
|
code += chars[Math.floor(Math.random() * chars.length)]
|
|
}
|
|
return code
|
|
}
|
|
|
|
function handleCreate() {
|
|
const name = roomName.value.trim()
|
|
const code = inviteCode.value.trim() || generateCode()
|
|
const user = userName.value.trim()
|
|
if (!name || !user) return
|
|
emit('submit', name, code, user, description.value.trim(), { ...compression.value })
|
|
}
|
|
|
|
function focusRoomInput() {
|
|
nextTick(() => roomInput.value?.focus())
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="create-form">
|
|
<div class="form-group">
|
|
<label class="form-label">{{ t('groupChat.yourName') }}</label>
|
|
<NInput
|
|
v-model:value="userName"
|
|
:placeholder="t('groupChat.yourNamePlaceholder')"
|
|
@keyup.enter="focusRoomInput"
|
|
/>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">{{ t('groupChat.yourDescription') }}</label>
|
|
<NInput
|
|
v-model:value="description"
|
|
type="textarea"
|
|
:rows="2"
|
|
:placeholder="t('groupChat.yourDescriptionPlaceholder')"
|
|
/>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">{{ t('groupChat.roomName') }}</label>
|
|
<NInput
|
|
ref="roomInput"
|
|
v-model:value="roomName"
|
|
:placeholder="t('groupChat.roomNamePlaceholder')"
|
|
@keyup.enter="handleCreate"
|
|
/>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">{{ t('groupChat.inviteCode') }}</label>
|
|
<div class="code-row">
|
|
<NInput
|
|
v-model:value="inviteCode"
|
|
:placeholder="t('groupChat.autoGenerate')"
|
|
/>
|
|
<NButton size="small" @click="inviteCode = generateCode()">
|
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<polyline points="23 4 23 10 17 10" /><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10" />
|
|
</svg>
|
|
</NButton>
|
|
</div>
|
|
</div>
|
|
|
|
<NCollapse class="compression-collapse">
|
|
<NCollapseItem :title="t('groupChat.compressionSettings')" name="compression">
|
|
<div class="compression-fields">
|
|
<div class="form-group">
|
|
<label class="form-label">{{ t('groupChat.triggerTokens') }}</label>
|
|
<NInputNumber v-model:value="compression.triggerTokens" :min="1000" :step="1000" style="width: 100%" />
|
|
<p class="form-hint">{{ t('groupChat.triggerTokensDesc') }}</p>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">{{ t('groupChat.maxHistoryTokens') }}</label>
|
|
<NInputNumber v-model:value="compression.maxHistoryTokens" :min="1000" :step="1000" style="width: 100%" />
|
|
<p class="form-hint">{{ t('groupChat.maxHistoryTokensDesc') }}</p>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">{{ t('groupChat.tailMessageCount') }}</label>
|
|
<NInputNumber v-model:value="compression.tailMessageCount" :min="1" :step="5" style="width: 100%" />
|
|
<p class="form-hint">{{ t('groupChat.tailMessageCountDesc') }}</p>
|
|
</div>
|
|
</div>
|
|
</NCollapseItem>
|
|
</NCollapse>
|
|
|
|
<div class="modal-actions">
|
|
<NSpace justify="end">
|
|
<NButton @click="emit('cancel')">{{ t('common.cancel') }}</NButton>
|
|
<NButton type="primary" :disabled="!roomName.trim() || !userName.trim()" @click="handleCreate">{{ t('common.create') }}</NButton>
|
|
</NSpace>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped lang="scss">
|
|
@use "@/styles/variables" as *;
|
|
|
|
.create-form {
|
|
.form-group {
|
|
margin-bottom: 16px;
|
|
}
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
color: $text-secondary;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.form-hint {
|
|
font-size: 11px;
|
|
color: $text-muted;
|
|
margin: 4px 0 0;
|
|
}
|
|
|
|
.code-row {
|
|
display: flex;
|
|
gap: 8px;
|
|
align-items: center;
|
|
}
|
|
|
|
.compression-collapse {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.compression-fields {
|
|
padding-top: 8px;
|
|
}
|
|
</style>
|