From a84b8617a6055bb4cfd8de44c107d99e3cba83de Mon Sep 17 00:00:00 2001 From: ViperEkura <3081035982@qq.com> Date: Mon, 13 Apr 2026 08:38:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E7=88=AC=E8=99=AB?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- asserts/ARCHITECTURE.md | 11 +- config.yaml | 2 +- dashboard/src/components/MessageBubble.vue | 4 +- dashboard/src/components/ProcessBlock.vue | 33 ++- dashboard/src/style.css | 4 + dashboard/src/utils/markdown.js | 4 +- .../src/views/ConversationDetailView.vue | 16 +- dashboard/src/views/SettingsView.vue | 11 +- luxx/models.py | 22 +- luxx/routes/messages.py | 6 +- luxx/services/chat.py | 14 +- luxx/tools/builtin/crawler.py | 207 ++++++--------- luxx/tools/executor.py | 4 +- luxx/tools/services.py | 247 ++++++++++++++++++ pyproject.toml | 7 +- luxx/run.py => run.py | 0 17 files changed, 422 insertions(+), 172 deletions(-) create mode 100644 luxx/tools/services.py rename luxx/run.py => run.py (100%) diff --git a/.gitignore b/.gitignore index 4c91ea5..06b7103 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ !README.md !.gitignore -!luxx/**/*.py +!*.py !asserts/**/*.md # Dashboard diff --git a/asserts/ARCHITECTURE.md b/asserts/ARCHITECTURE.md index e9dfc60..eeffd90 100644 --- a/asserts/ARCHITECTURE.md +++ b/asserts/ARCHITECTURE.md @@ -5,9 +5,13 @@ - **框架**: FastAPI 0.109+ - **数据库**: SQLAlchemy 2.0+ - **认证**: JWT (PyJWT) -- **HTTP客户端**: httpx +- **HTTP客户端**: httpx, requests - **配置**: YAML (PyYAML) - **代码执行**: Python 原生执行 +- **网页爬虫**: + - `httpx` - HTTP 客户端 + - `beautifulsoup4` - HTML 解析 + - `lxml` - XML/HTML 解析器 ## 目录结构 @@ -36,6 +40,7 @@ luxx/ │ ├── crawler.py # 网页爬虫 │ ├── data.py # 数据处理 │ └── weather.py # 天气查询 +│ └── services.py # 工具服务层 └── utils/ # 工具函数 └── helpers.py ``` @@ -205,7 +210,9 @@ classDiagram |------|------|------| | `python_execute` | 执行 Python 代码 | 支持 print 输出、变量访问 | | `python_eval` | 计算表达式 | 快速求值 | -| `web_crawl` | 网页抓取 | BeautifulSoup + httpx | +| `web_search` | DuckDuckGo HTML | DuckDuckGo HTML 搜索 | +| `web_fetch` | 网页抓取 | httpx + BeautifulSoup,支持 text/links/structured | +| `batch_fetch` | 批量抓取 | 并发获取多个页面 | | `get_weather` | 天气查询 | 支持城市名查询 | | `process_data` | 数据处理 | JSON 转换、格式化等 | diff --git a/config.yaml b/config.yaml index f13c4e2..b83a005 100644 --- a/config.yaml +++ b/config.yaml @@ -7,7 +7,7 @@ app: database: type: sqlite - url: sqlite:///../chat.db + url: sqlite:///./chat.db llm: provider: deepseek diff --git a/dashboard/src/components/MessageBubble.vue b/dashboard/src/components/MessageBubble.vue index 34addad..95880fc 100644 --- a/dashboard/src/components/MessageBubble.vue +++ b/dashboard/src/components/MessageBubble.vue @@ -66,7 +66,9 @@ const renderedContent = computed(() => { function formatTime(time) { if (!time) return '' - return new Date(time).toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' }) + const date = new Date(time) + // 使用本地时区显示 + return date.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' }) } function copyContent() { diff --git a/dashboard/src/components/ProcessBlock.vue b/dashboard/src/components/ProcessBlock.vue index 4be9abd..e345c74 100644 --- a/dashboard/src/components/ProcessBlock.vue +++ b/dashboard/src/components/ProcessBlock.vue @@ -9,10 +9,11 @@ 思考中 {{ item.brief || '正在思考...' }} ... + 已截断
{{ item.fullResult || item.resultSummary }}
{{ item.displayResult }}