From 793003fcf6ce988b4ee299e12955c1e68873ae53 Mon Sep 17 00:00:00 2001 From: ekko <152005280+EKKOLearnAI@users.noreply.github.com> Date: Sat, 2 May 2026 15:39:01 +0800 Subject: [PATCH] feat(chat): redesign attachments with ContentBlock format and file downloads (#397) - Redesign attachment handling using Anthropic-style ContentBlock array format with discriminated unions (text, image, file types) - Add frontend file download functionality supporting both ContentBlock and Markdown formats with authentication tokens - Fix multi-process conflict causing SQLite database resets by eliminating redundant nodemon instances - Update chat store to build ContentBlock arrays from attachments - Improve image handling with base64 conversion for upstream API Co-authored-by: Claude Sonnet 4.6 --- package.json | 2 +- packages/client/src/api/hermes/chat.ts | 9 +- .../components/hermes/chat/MessageItem.vue | 119 +++++++++++++++++- packages/client/src/data/changelog.ts | 24 ++-- packages/client/src/i18n/locales/de.ts | 8 ++ packages/client/src/i18n/locales/en.ts | 8 ++ packages/client/src/i18n/locales/es.ts | 8 ++ packages/client/src/i18n/locales/fr.ts | 8 ++ packages/client/src/i18n/locales/ja.ts | 8 ++ packages/client/src/i18n/locales/ko.ts | 8 ++ packages/client/src/i18n/locales/pt.ts | 8 ++ packages/client/src/i18n/locales/zh.ts | 8 ++ packages/client/src/stores/hermes/chat.ts | 64 ++++++++-- .../src/services/hermes/chat-run-socket.ts | 79 ++++++++++-- 14 files changed, 331 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 60a34a34..e4d03e70 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hermes-web-ui", - "version": "0.5.5", + "version": "0.5.6", "description": "Self-hosted AI chat dashboard for Hermes Agent — multi-model (Claude, GPT, Gemini, DeepSeek) web UI with Telegram, Discord, Slack, WhatsApp integration", "repository": { "type": "git", diff --git a/packages/client/src/api/hermes/chat.ts b/packages/client/src/api/hermes/chat.ts index 444a036d..3a6b7461 100644 --- a/packages/client/src/api/hermes/chat.ts +++ b/packages/client/src/api/hermes/chat.ts @@ -1,13 +1,18 @@ import { io, type Socket } from 'socket.io-client' import { request, getBaseUrlValue, getApiKey } from '../client' +export type ContentBlock = + | { type: 'text'; text: string } + | { type: 'image'; name: string; path: string; media_type: string } + | { type: 'file'; name: string; path: string; media_type?: string } + export interface ChatMessage { role: 'user' | 'assistant' | 'system' - content: string + content: string | ContentBlock[] } export interface StartRunRequest { - input: string | ChatMessage[] + input: string | ContentBlock[] instructions?: string session_id?: string model?: string diff --git a/packages/client/src/components/hermes/chat/MessageItem.vue b/packages/client/src/components/hermes/chat/MessageItem.vue index ac80a11f..deed7972 100644 --- a/packages/client/src/components/hermes/chat/MessageItem.vue +++ b/packages/client/src/components/hermes/chat/MessageItem.vue @@ -1,9 +1,10 @@