mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 03:00:23 +00:00
@@ -137,10 +137,18 @@ def session_status(session_id: str) -> dict[str, Any]:
|
||||
s = get_session(session_id)
|
||||
inp = int(s.input_tokens or 0)
|
||||
out = int(s.output_tokens or 0)
|
||||
profile = getattr(s, 'profile', None) or 'default'
|
||||
try:
|
||||
from api.profiles import get_hermes_home_for_profile
|
||||
hermes_home = str(get_hermes_home_for_profile(profile))
|
||||
except Exception:
|
||||
hermes_home = ''
|
||||
return {
|
||||
'session_id': s.session_id,
|
||||
'title': s.title,
|
||||
'model': s.model,
|
||||
'profile': profile,
|
||||
'hermes_home': hermes_home,
|
||||
'workspace': s.workspace,
|
||||
'personality': s.personality,
|
||||
'message_count': len(s.messages or []),
|
||||
|
||||
+2
-1
@@ -799,7 +799,7 @@ async function cmdStatus(){
|
||||
if(r&&r.error){showToast(r.error);return;}
|
||||
// Build status card lines matching CLI /status output
|
||||
const provider=window._activeProvider||'';
|
||||
const profile=S.activeProfile||'default';
|
||||
const profile=r.profile||S.activeProfile||'default';
|
||||
const started=r.created_at?new Date(r.created_at).toLocaleString():t('status_unknown');
|
||||
const fmtNum=n=>typeof n==='number'?n.toLocaleString():'0';
|
||||
const tokens=r.total_tokens?`${fmtNum(r.input_tokens)} in / ${fmtNum(r.output_tokens)} out`:t('status_no_tokens');
|
||||
@@ -810,6 +810,7 @@ async function cmdStatus(){
|
||||
`**${t('status_title')}:** ${r.title||t('untitled')}`,
|
||||
`**${t('status_model')}:** ${r.model||t('usage_default_model')}${provider?' ('+provider+')':''}`,
|
||||
`**${t('status_profile')}:** ${profile}`,
|
||||
`**${t('status_hermes_home')}:** ${r.hermes_home||t('status_unknown')}`,
|
||||
`**${t('status_workspace')}:** ${r.workspace}`,
|
||||
`**${t('status_personality')}:** ${r.personality||t('usage_personality_none')}`,
|
||||
`**${t('status_started')}:** ${started}`,
|
||||
|
||||
@@ -208,6 +208,7 @@ const LOCALES = {
|
||||
status_messages:'Messages',
|
||||
status_agent_running:'Agent running',
|
||||
status_profile: 'Profile',
|
||||
status_hermes_home: 'Hermes home',
|
||||
status_started: 'Started',
|
||||
status_tokens: 'Tokens',
|
||||
status_no_tokens: 'No tokens used',
|
||||
@@ -1477,6 +1478,7 @@ const LOCALES = {
|
||||
settings_tab_system: 'System',
|
||||
status_no_tokens: 'No token data',
|
||||
status_profile: 'Profile',
|
||||
status_hermes_home: 'Hermes home',
|
||||
status_started: 'Started',
|
||||
status_tokens: 'Tokens',
|
||||
status_unknown: 'Unknown',
|
||||
@@ -2209,6 +2211,7 @@ const LOCALES = {
|
||||
settings_tab_system: 'System',
|
||||
status_no_tokens: 'No token data',
|
||||
status_profile: 'Profile',
|
||||
status_hermes_home: 'Hermes home',
|
||||
status_started: 'Started',
|
||||
status_tokens: 'Tokens',
|
||||
status_unknown: 'Unknown',
|
||||
@@ -2715,6 +2718,7 @@ const LOCALES = {
|
||||
settings_tab_system: 'System',
|
||||
status_no_tokens: 'No token data',
|
||||
status_profile: 'Profile',
|
||||
status_hermes_home: 'Hermes home',
|
||||
status_started: 'Started',
|
||||
status_tokens: 'Tokens',
|
||||
status_unknown: 'Unknown',
|
||||
@@ -3674,6 +3678,7 @@ const LOCALES = {
|
||||
settings_tab_system: 'System',
|
||||
status_no_tokens: 'No token data',
|
||||
status_profile: 'Profile',
|
||||
status_hermes_home: 'Hermes home',
|
||||
status_started: 'Started',
|
||||
status_tokens: 'Tokens',
|
||||
status_unknown: 'Unknown',
|
||||
@@ -4432,6 +4437,7 @@ const LOCALES = {
|
||||
providers_tab_title: '供應商',
|
||||
status_agent_running: 'Agent 執行中',
|
||||
status_profile: '個人資料',
|
||||
status_hermes_home: 'Hermes 主目錄',
|
||||
status_started: '開始時間',
|
||||
status_tokens: 'Token',
|
||||
status_no_tokens: '未使用 Token',
|
||||
@@ -4732,6 +4738,7 @@ const LOCALES = {
|
||||
status_messages: 'Mensagens',
|
||||
status_agent_running: 'Agente rodando',
|
||||
status_profile: 'Perfil',
|
||||
status_hermes_home: 'Diretório Hermes',
|
||||
status_started: 'Iniciado',
|
||||
status_tokens: 'Tokens',
|
||||
status_no_tokens: 'Nenhum token usado',
|
||||
@@ -5416,6 +5423,7 @@ const LOCALES = {
|
||||
status_messages: '메시지',
|
||||
status_agent_running: '에이전트 실행 중',
|
||||
status_profile: '프로필',
|
||||
status_hermes_home: 'Hermes 홈',
|
||||
status_started: '시작 시간',
|
||||
status_tokens: '토큰',
|
||||
status_no_tokens: '사용된 토큰 없음',
|
||||
|
||||
@@ -11,7 +11,7 @@ import urllib.error
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.conftest import TEST_BASE, _post, make_session_tracked
|
||||
from tests.conftest import TEST_BASE, TEST_STATE_DIR, _post, make_session_tracked
|
||||
|
||||
|
||||
def _get(path):
|
||||
@@ -218,6 +218,8 @@ def test_status_returns_summary(cleanup_test_sessions):
|
||||
assert r['title'] == 'test'
|
||||
assert r['message_count'] == 3
|
||||
assert 'model' in r
|
||||
assert r['profile'] == 'default'
|
||||
assert r['hermes_home'] == str(TEST_STATE_DIR)
|
||||
assert 'workspace' in r
|
||||
assert 'created_at' in r
|
||||
assert 'updated_at' in r
|
||||
@@ -233,6 +235,17 @@ def test_status_returns_summary(cleanup_test_sessions):
|
||||
assert r['total_tokens'] == 0
|
||||
|
||||
|
||||
def test_status_returns_profile_specific_hermes_home(cleanup_test_sessions):
|
||||
data = _post(TEST_BASE, '/api/session/new', {'profile': 'research'})
|
||||
sid = data['session']['session_id']
|
||||
cleanup_test_sessions.append(sid)
|
||||
|
||||
r = _get(f'/api/session/status?session_id={sid}')
|
||||
|
||||
assert r['profile'] == 'research'
|
||||
assert r['hermes_home'] == str(TEST_STATE_DIR / 'profiles' / 'research')
|
||||
|
||||
|
||||
def test_status_unknown_returns_404():
|
||||
try:
|
||||
_get('/api/session/status?session_id=nonexistent_zzz')
|
||||
|
||||
Reference in New Issue
Block a user