feat: 前后端分离架构 — FastAPI SSE后端 + Vue 3前端
将单体 Streamlit 应用拆分为三层架构: - api_server.py: FastAPI SSE 流式后端 (端口 8000) - frontend/: Vue 3 + Vite + Pinia 聊天前端 (端口 5173) - agent/graph.py: 新增 node_start 回调支持 - 更新启动脚本为三服务模式 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/** Date formatting and text utilities. */
|
||||
|
||||
export function formatTime(iso: string): string {
|
||||
if (!iso) return ''
|
||||
const d = new Date(iso)
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`
|
||||
}
|
||||
|
||||
export function truncate(str: string, max: number): string {
|
||||
if (!str) return ''
|
||||
return str.length > max ? str.slice(0, max) + '...' : str
|
||||
}
|
||||
|
||||
export function fileIcon(filename: string): string {
|
||||
const ext = filename.split('.').pop()?.toLowerCase() || ''
|
||||
const map: Record<string, string> = {
|
||||
png: '🖼', jpg: '🖼', jpeg: '🖼', bmp: '🖼', webp: '🖼',
|
||||
pdf: '📄', docx: '📝', doc: '📝',
|
||||
xlsx: '📊', xls: '📊',
|
||||
txt: '📃', csv: '📃',
|
||||
}
|
||||
return map[ext] || '📎'
|
||||
}
|
||||
Reference in New Issue
Block a user