mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-10 11:17:41 +08:00
feat: add unified response history session management across Claude, Gemini, and OpenAI API backends
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -123,7 +123,6 @@ export function useChatStreamClient({
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${effectiveKey}`,
|
||||
'X-Ds2-Source': 'admin-webui-api-tester',
|
||||
}
|
||||
if (requestAccount) {
|
||||
headers['X-Ds2-Target-Account'] = requestAccount
|
||||
|
||||
@@ -10,6 +10,9 @@ import {
|
||||
VIEW_MODE_KEY,
|
||||
} from './chatHistoryUtils'
|
||||
|
||||
const LIST_REFRESH_MS = 1500
|
||||
const STREAMING_DETAIL_REFRESH_MS = 750
|
||||
|
||||
export default function ChatHistoryContainer({ authFetch, onMessage }) {
|
||||
const { t, lang } = useI18n()
|
||||
const apiFetch = authFetch || fetch
|
||||
@@ -136,7 +139,7 @@ export default function ChatHistoryContainer({ authFetch, onMessage }) {
|
||||
if (!autoRefreshReady || limit === DISABLED_LIMIT) return undefined
|
||||
const timer = window.setInterval(() => {
|
||||
loadList({ mode: 'silent', announceError: false })
|
||||
}, 5000)
|
||||
}, LIST_REFRESH_MS)
|
||||
return () => window.clearInterval(timer)
|
||||
}, [autoRefreshReady, limit])
|
||||
|
||||
@@ -144,7 +147,7 @@ export default function ChatHistoryContainer({ authFetch, onMessage }) {
|
||||
if (!autoRefreshReady || !selectedId || selectedSummary?.status !== 'streaming') return undefined
|
||||
const timer = window.setInterval(() => {
|
||||
loadDetail(selectedId, { announceError: false })
|
||||
}, 1000)
|
||||
}, STREAMING_DETAIL_REFRESH_MS)
|
||||
return () => window.clearInterval(timer)
|
||||
}, [autoRefreshReady, selectedId, selectedSummary?.status])
|
||||
|
||||
|
||||
@@ -207,6 +207,10 @@ function MetaGrid({ selectedItem, t }) {
|
||||
{formatElapsed(selectedItem.elapsed_ms, t)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="rounded-lg border border-border bg-card px-3 py-2">
|
||||
<div className="text-[11px] text-muted-foreground">{t('chatHistory.metaSurface')}</div>
|
||||
<div className="text-sm font-medium text-foreground break-all">{selectedItem.surface || t('chatHistory.metaUnknown')}</div>
|
||||
</div>
|
||||
<div className="rounded-lg border border-border bg-card px-3 py-2">
|
||||
<div className="text-[11px] text-muted-foreground">{t('chatHistory.metaModel')}</div>
|
||||
<div className="text-sm font-medium text-foreground break-all">{selectedItem.model || t('chatHistory.metaUnknown')}</div>
|
||||
|
||||
@@ -69,7 +69,7 @@ export function ChatHistoryListPane({ items, selectedItem, deletingId, t, lang,
|
||||
{item.user_input || t('chatHistory.untitled')}
|
||||
</div>
|
||||
<div className="text-[11px] text-muted-foreground mt-1 truncate">
|
||||
{item.model || '-'}
|
||||
{[item.surface, item.model].filter(Boolean).join(' · ') || '-'}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 shrink-0">
|
||||
|
||||
Reference in New Issue
Block a user