完善前端页面
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -144,12 +144,19 @@ class RedisDB:
|
||||
Returns:
|
||||
是否成功
|
||||
"""
|
||||
if not self._connected or not self.client:
|
||||
logger.warning(f"Redis未连接,跳过任务状态更新: {task_id}")
|
||||
return False
|
||||
try:
|
||||
key = f"task:{task_id}"
|
||||
data = {
|
||||
"status": status,
|
||||
"meta": meta or {},
|
||||
}
|
||||
return await self.set_json(key, data, expire)
|
||||
except Exception as e:
|
||||
logger.warning(f"设置任务状态失败: {task_id}, error: {e}")
|
||||
return False
|
||||
|
||||
async def get_task_status(self, task_id: str) -> Optional[Dict[str, Any]]:
|
||||
"""
|
||||
@@ -161,8 +168,15 @@ class RedisDB:
|
||||
Returns:
|
||||
状态信息
|
||||
"""
|
||||
if not self._connected or not self.client:
|
||||
logger.warning(f"Redis未连接,无法获取任务状态: {task_id}")
|
||||
return None
|
||||
try:
|
||||
key = f"task:{task_id}"
|
||||
return await self.get_json(key)
|
||||
except Exception as e:
|
||||
logger.warning(f"获取任务状态失败: {task_id}, error: {e}")
|
||||
return None
|
||||
|
||||
async def update_task_progress(
|
||||
self,
|
||||
@@ -181,6 +195,10 @@ class RedisDB:
|
||||
Returns:
|
||||
是否成功
|
||||
"""
|
||||
if not self._connected or not self.client:
|
||||
logger.warning(f"Redis未连接,跳过任务进度更新: {task_id}")
|
||||
return False
|
||||
try:
|
||||
data = await self.get_task_status(task_id)
|
||||
if data:
|
||||
data["meta"]["progress"] = progress
|
||||
@@ -189,6 +207,9 @@ class RedisDB:
|
||||
key = f"task:{task_id}"
|
||||
return await self.set_json(key, data, expire=86400)
|
||||
return False
|
||||
except Exception as e:
|
||||
logger.warning(f"更新任务进度失败: {task_id}, error: {e}")
|
||||
return False
|
||||
|
||||
# ==================== 缓存操作 ====================
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,39 +1,29 @@
|
||||
import React from 'react';
|
||||
import { Link, useLocation, Outlet, useNavigate } from 'react-router-dom';
|
||||
import { Link, useLocation, Outlet } from 'react-router-dom';
|
||||
import {
|
||||
LayoutDashboard,
|
||||
FileText,
|
||||
TableProperties,
|
||||
MessageSquareCode,
|
||||
LogOut,
|
||||
Menu,
|
||||
X,
|
||||
ChevronRight,
|
||||
User,
|
||||
Sparkles
|
||||
Sparkles,
|
||||
Clock
|
||||
} from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { useAuth } from '@/context/AuthContext';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet';
|
||||
|
||||
const navItems = [
|
||||
{ name: '控制台', path: '/', icon: LayoutDashboard },
|
||||
{ name: '文档中心', path: '/documents', icon: FileText },
|
||||
{ name: 'Excel 解析', path: '/excel-parse', icon: Sparkles },
|
||||
{ name: '智能填表', path: '/form-fill', icon: TableProperties },
|
||||
{ name: '智能助手', path: '/assistant', icon: MessageSquareCode },
|
||||
{ name: '任务历史', path: '/task-history', icon: Clock },
|
||||
];
|
||||
|
||||
const MainLayout: React.FC = () => {
|
||||
const { user, profile, signOut } = useAuth();
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleSignOut = async () => {
|
||||
await signOut();
|
||||
navigate('/login');
|
||||
};
|
||||
|
||||
const SidebarContent = () => (
|
||||
<div className="flex flex-col h-full bg-sidebar py-6 border-r border-sidebar-border">
|
||||
@@ -70,25 +60,17 @@ const MainLayout: React.FC = () => {
|
||||
</nav>
|
||||
|
||||
<div className="px-4 mt-auto">
|
||||
<div className="bg-sidebar-accent/50 rounded-2xl p-4 mb-4 border border-sidebar-border/50">
|
||||
<div className="bg-sidebar-accent/50 rounded-2xl p-4 border border-sidebar-border/50">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 rounded-full bg-secondary flex items-center justify-center border-2 border-primary/10">
|
||||
<User size={20} className="text-primary" />
|
||||
<Sparkles size={20} className="text-primary" />
|
||||
</div>
|
||||
<div className="flex flex-col overflow-hidden">
|
||||
<span className="font-semibold text-sm truncate">{((profile as any)?.email) || '用户'}</span>
|
||||
<span className="text-[10px] uppercase tracking-wider text-muted-foreground">{((profile as any)?.role) || 'User'}</span>
|
||||
<span className="font-semibold text-sm truncate">智联文档</span>
|
||||
<span className="text-[10px] uppercase tracking-wider text-muted-foreground">多源数据融合</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
variant="outline"
|
||||
className="w-full justify-start gap-3 border-none hover:bg-destructive/10 hover:text-destructive group rounded-xl"
|
||||
onClick={handleSignOut}
|
||||
>
|
||||
<LogOut size={18} className="group-hover:rotate-180 transition-transform duration-300" />
|
||||
<span>退出登录</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,12 @@
|
||||
import { createBrowserRouter, Navigate } from 'react-router-dom';
|
||||
import Login from '@/pages/Login';
|
||||
import Dashboard from '@/pages/Dashboard';
|
||||
import Documents from '@/pages/Documents';
|
||||
import FormFill from '@/pages/FormFill';
|
||||
import Assistant from '@/pages/Assistant';
|
||||
import ExcelParse from '@/pages/ExcelParse';
|
||||
import TemplateFill from '@/pages/TemplateFill';
|
||||
import InstructionChat from '@/pages/InstructionChat';
|
||||
import TaskHistory from '@/pages/TaskHistory';
|
||||
import MainLayout from '@/components/layouts/MainLayout';
|
||||
|
||||
export const routes = [
|
||||
{
|
||||
path: '/login',
|
||||
element: <Login />,
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
element: <MainLayout />,
|
||||
@@ -26,15 +21,15 @@ export const routes = [
|
||||
},
|
||||
{
|
||||
path: '/form-fill',
|
||||
element: <FormFill />,
|
||||
element: <TemplateFill />,
|
||||
},
|
||||
{
|
||||
path: '/assistant',
|
||||
element: <Assistant />,
|
||||
element: <InstructionChat />,
|
||||
},
|
||||
{
|
||||
path: '/excel-parse',
|
||||
element: <ExcelParse />,
|
||||
path: '/task-history',
|
||||
element: <TaskHistory />,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user