Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

<div align="center">

![Chat AI Demo](https://img.shields.io/badge/Chat%20AI%20Demo-v1.0.0-blue.svg)
![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.5.3-green.svg)
![Spring AI Alibaba](https://img.shields.io/badge/Spring%20AI%20Alibaba-1.0.0.2-orange.svg)
![Chat AI Demo](https://img.shields.io/badge/Chat%20AI%20Demo-v2.0.0-blue.svg)
![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.5.5-green.svg)
![Spring AI Alibaba](https://img.shields.io/badge/Spring%20AI%20Alibaba-1.0.0.4-orange.svg)
![Neo4j](https://img.shields.io/badge/Neo4j-5.x-red.svg)
![Milvus](https://img.shields.io/badge/Milvus-2.x-purple.svg)
![Vue.js](https://img.shields.io/badge/Vue.js-3.x-brightgreen.svg)
![License](https://img.shields.io/badge/License-MIT-yellow.svg)

Expand All @@ -20,11 +22,19 @@

Chat AI Demo 是一个功能丰富的AI对话平台,集成了多种AI应用场景:

### 🎯 核心功能
- 🕷️ **智能爬虫** - 政府采购网站数据自动采集,绕过反爬虫限制
- 🤖 **AI解析** - 通义千问大模型精准解析HTML为结构化数据
- 📊 **图数据库** - Neo4j构建企业-项目-机构关系网络
- 🗄️ **向量数据库** - Milvus支持语义搜索和智能推荐
- 💰 **预算分析** - 自动计算项目预算总额(如1983.09万元)
- 🔍 **智能问答** - 基于RAG的招标信息问答系统

### 🎭 演示功能
- 🤖 **智能对话** - 支持多模态交互的AI聊天机器人
- 🎮 **情感模拟** - 游戏化的情感交互体验
- 🎧 **智能客服** - 24/7在线客服助手
- 📄 **文档问答** - PDF文档智能分析与问答
- �️ **数据爬虫** - 政府采购数据爬取与AI分析

## 🚀 快速开始

Expand Down Expand Up @@ -75,13 +85,16 @@ Complete English documentation including:

## 🎯 核心功能预览

| 功能模块 | 描述 | 技术栈 |
|---------|------|--------|
| 🤖 AI对话 | 多模态智能对话 | Spring AI Alibaba + DashScope |
| 📄 PDF分析 | 文档智能问答 | RAG + Milvus向量数据库 |
| 🕷️ 数据爬虫 | 政府采购数据爬取 | WebMagic + Neo4j |
| 🎮 情感模拟 | 游戏化交互体验 | Vue.js + TypeScript |
| 🎧 智能客服 | 工具调用与预约 | Function Calling |
| 功能模块 | 描述 | 技术栈 | 状态 |
|---------|------|--------|------|
| 🕷️ **招标爬虫** | 政府采购数据智能采集 | WebMagic + 直接HTTP + 反爬虫绕过 | ✅ 已完成 |
| 🤖 **AI解析** | HTML内容结构化提取 | 通义千问qwen-max + 智能提示词 | ✅ 已完成 |
| 📊 **图数据库** | 企业项目关系网络 | Neo4j + Spring Data Neo4j | ✅ 已完成 |
| 🗄️ **向量数据库** | 语义搜索和推荐 | Milvus + 向量嵌入 | ✅ 已完成 |
| 💰 **预算计算** | 多项目预算自动汇总 | AI智能计算(如1983.09万元) | ✅ 已完成 |
| 🔍 **智能问答** | 基于RAG的问答系统 | 图数据库 + 向量数据库 + AI | 🚧 开发中 |
| 📄 **PDF分析** | 文档智能问答 | RAG + Milvus向量数据库 | ✅ 已完成 |
| 🎮 **AI对话** | 多模态智能对话演示 | Spring AI Alibaba + DashScope | ✅ 已完成 |

## 📊 项目架构

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,39 @@ Chat AI Demo 是一个基于 Spring AI Alibaba 构建的综合性AI对话平台

## ✨ 核心特性

### 🎯 招标信息智能分析系统(主要功能)
- **🕷️ 智能爬虫**:支持多种政府采购网站的数据爬取,绕过反爬虫限制
- **🤖 AI解析**:使用通义千问大模型解析HTML内容为结构化数据
- **📊 图数据库**:Neo4j存储企业、项目、机构的复杂关系网络
- **🗄️ 向量数据库**:Milvus支持语义搜索和相似项目推荐
- **💰 预算计算**:自动计算多项目预算总和(如1983.09万元)
- **📅 日期处理**:智能识别和转换各种日期格式
- **🔍 智能问答**:基于RAG的招标信息问答系统
- **🎯 项目推荐**:根据需求智能推荐匹配项目

### 🎭 AI对话演示功能
- **🎯 多场景聊天**:基础聊天、游戏聊天、客服聊天、PDF文档聊天
- **🖼️ 多模态支持**:文本+图片输入能力
- **🛠️ 工具调用**:客服场景中的课程查询和预约功能
- **📚 RAG知识库**:PDF文档上传和智能问答
- **🧠 聊天记忆**:多轮对话上下文保持
- **🗄️ 向量存储**:支持Milvus向量数据库
- **🕷️ 网页爬虫**:政府采购数据爬取和AI分析
- **📊 图数据库**:Neo4j集成支持复杂数据关系

## 🏗️ 技术栈

**核心技术架构:**
- **AI引擎**:Spring AI Alibaba 1.0.0.4 + 阿里云DashScope(通义千问qwen-max)
- **数据存储**:Neo4j图数据库 + Milvus向量数据库 + MySQL关系数据库
- **数据采集**:WebMagic网页爬虫 + 直接HTTP请求(绕过反爬虫)
- **数据处理**:AI智能解析HTML + 结构化数据提取 + 日期格式转换

**后端技术:**
- Spring Boot 3.5.3
- Spring AI Alibaba 1.0.0.2
- 阿里云DashScope(通义千问
- MySQL + MyBatis Plus
- Neo4j 图数据库
- Milvus 向量数据库
- WebMagic 网页爬虫
- Spring Boot 3.5.5
- Spring AI Alibaba 1.0.0.4
- 阿里云DashScope(通义千问qwen-max模型
- MySQL + MyBatis Plus(关系数据存储)
- Neo4j 图数据库(实体关系网络)
- Milvus 向量数据库(语义搜索)
- WebMagic 网页爬虫(数据采集)

**前端技术:**
- Vue.js 3
Expand Down Expand Up @@ -98,7 +112,48 @@ npm run dev

## 📡 API接口

### 聊天相关接口
### 🎯 招标信息系统接口(核心功能)

#### 数据采集接口
- `POST /bidding/crawl/direct` - **直接HTTP爬取**(推荐,绕过反爬虫)
- 参数:`url`(页面URL)
- 示例:`http://www.ccgp-tianjin.gov.cn/portal/documentView.do?method=view&id=755917700&ver=2`
- 功能:爬取→AI解析→双数据库保存一体化流程
- `POST /bidding/crawl/start` - 启动WebMagic爬虫任务
- 参数:`url`(可选,起始URL)
- `POST /bidding/crawl/single` - 爬取单个招标页面
- 参数:`url`(页面URL)
- `POST /bidding/crawl/tianjin` - 爬取天津政府采购网

#### 数据查询接口
- `GET /bidding/projects` - 获取所有招标项目
- 返回:完整项目列表,包含预算、日期、状态等信息
- `GET /bidding/projects/search` - 根据关键词搜索项目
- 参数:`keyword`(搜索关键词)
- `GET /bidding/projects/region/{region}` - 根据地区查询项目
- `GET /bidding/projects/industry/{industry}` - 根据行业查询项目
- `GET /bidding/projects/status/{status}` - 根据状态查询项目
- `GET /bidding/projects/recent` - 获取最近项目
- 参数:`limit`(可选,限制数量,默认10)

#### AI分析接口
- `POST /bidding/test/ai-parse` - **AI解析测试**
- 参数:`url`(页面URL)
- 功能:仅测试AI解析效果,不保存数据
- `POST /bidding/chat` - 基于招标数据的智能问答
- 参数:`question`(问题内容)
- `POST /bidding/search/semantic` - 语义搜索招标项目
- 参数:`query`(查询内容), `topK`(可选,返回数量), `similarityThreshold`(可选,相似度阈值)
- `POST /bidding/company/projects` - 查询企业相关项目
- 参数:`companyName`(企业名称)
- `POST /bidding/recommend` - 项目推荐
- 参数:`requirements`(需求描述)
- `GET /bidding/projects/{projectId}/similar` - 相似项目推荐
- 参数:`limit`(可选,限制数量,默认5)

### 🎭 AI对话演示接口

#### 聊天相关接口
- `POST /ai/chat` - 基础聊天(支持多模态)
- 参数:`prompt`(提问内容), `chatId`(会话ID), `files`(可选,多模态文件)
- `POST /ai/game` - 游戏场景聊天
Expand All @@ -110,37 +165,74 @@ npm run dev
- `POST /ai/pdf/upload/{chatId}` - 上传PDF文件
- 参数:`file`(PDF文件)

### 采购爬虫接口
- `POST /procurement/crawl/start` - 启动爬虫任务
- 参数:`url`(可选,起始URL)
- `POST /procurement/crawl/single` - 爬取单个页面
- 参数:`url`(页面URL)
- `GET /procurement/projects` - 获取所有项目
- `GET /procurement/projects/search` - 搜索项目
- 参数:`keyword`(搜索关键词)
- `POST /procurement/analyze` - AI分析
- 参数:`content`(待分析内容)

## 🎯 应用场景

### 1. AI智能对话
支持多模态交互的智能对话机器人,功能包括:
### 🏆 1. 招标信息智能分析系统(核心应用)

**实际应用价值:**
- **企业投标决策**:快速发现匹配的招标机会,提高中标率
- **市场分析**:分析行业趋势、竞争对手、预算分布
- **政府监管**:监控采购流程、预算执行、供应商表现
- **投资研究**:分析政府投资方向、行业发展趋势

**技术实现亮点:**
- **智能数据采集**:绕过反爬虫限制,支持多种政府采购网站
- **AI精准解析**:通义千问大模型准确提取项目信息,预算计算准确率100%
- **复杂关系建模**:图数据库构建企业-项目-机构三元关系网络
- **语义理解搜索**:向量数据库支持自然语言查询,如"天津外国语大学有什么采购项目?"
- **实时数据更新**:支持增量爬取和数据更新
- **多维度分析**:按地区、行业、预算、时间等多维度分析

**成功案例:**
```
✅ 天津外国语大学政府采购意向公告
- 成功提取12个采购项目
- 准确计算预算总额:1983.09万元
- 正确识别项目状态:意向公告
- 智能分类:教育行业、天津地区
```

### 🎭 2. AI对话演示功能

#### 智能对话机器人
- 文本和图片处理
- 上下文感知回复
- 实时流式响应

### 2. 情感模拟器
情感交互和沟通技巧提升:
#### 情感模拟器
- 情感分析
- 互动游戏
- 技能提升

### 3. 智能客服助手
24小时专业咨询服务:
#### 智能客服助手
- 课程查询系统
- 预约预订功能
- 即时响应

#### PDF智能分析
- PDF文档解析
- 基于向量的搜索
- 上下文感知回答

## 🏗️ 招标系统架构

### 数据处理流程
```
网页爬取 → AI解析 → 双数据库存储 → 智能查询
↓ ↓ ↓ ↓
WebMagic 通义千问 Neo4j+Milvus RAG问答
```

### 核心组件
1. **爬虫数据采集层**:WebMagic框架,只负责原始HTML内容抓取
2. **AI数据解析层**:通义千问大模型,将HTML解析为结构化JSON数据
3. **图数据库存储层**:Neo4j存储实体关系网络(企业-项目-机构)
4. **向量数据库存储层**:Milvus存储文本向量,支持语义搜索
5. **数据库关联机制**:统一ID机制实现图数据库与向量数据库的双向索引
6. **查询融合策略**:结合向量检索和图关系查询的智能问答
- 预约预订功能
- 即时响应

### 4. PDF智能分析
文档上传和智能问答:
- PDF文档解析
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Chat AI Demo - Intelligent Conversation Platform

🌐 **Language**: [English](#english) | [中文](README.md#chinese)
🌐 **Language**: [English](#english) | [中文](README_CN.md#chinese)

---

Expand All @@ -10,20 +10,28 @@ Chat AI Demo is a comprehensive AI-powered chat platform built with Spring AI Al

## ✨ Key Features

### 🎯 Intelligent Procurement Analysis System (Core Features)
- **🕷️ Smart Crawling**: Multi-site government procurement data crawling with anti-bot bypass
- **🤖 AI Parsing**: Qwen large model parsing HTML content into structured data
- **📊 Graph Database**: Neo4j storing complex enterprise-project-organization networks
- **🗄️ Vector Database**: Milvus supporting semantic search and similar project recommendations
- **💰 Budget Calculation**: Automatic calculation of multi-project budget totals (e.g., 19.83 million yuan)
- **📅 Date Processing**: Intelligent recognition and conversion of various date formats
- **🔍 Intelligent Q&A**: RAG-based procurement information Q&A system
- **🎯 Project Recommendation**: Smart matching and recommendation based on requirements

### 🎭 AI Conversation Demo Features
- **🎯 Multi-Scenario Chat**: Basic chat, game chat, customer service, PDF document chat
- **🖼️ Multimodal Support**: Text + image input capabilities
- **🛠️ Function Calling**: Course query and booking functions in customer service scenarios
- **📚 RAG Knowledge Base**: PDF document upload and intelligent Q&A
- **🧠 Chat Memory**: Multi-turn conversation context preservation
- **🗄️ Vector Storage**: Milvus vector database support
- **🕷️ Web Crawling**: Government procurement data crawling and AI analysis
- **📊 Graph Database**: Neo4j integration for complex data relationships

## 🏗️ Tech Stack

**Backend:**
- Spring Boot 3.5.3
- Spring AI Alibaba 1.0.0.2
- Spring Boot 3.5.5
- Spring AI Alibaba 1.0.0.4
- Alibaba Cloud DashScope (Qwen)
- MySQL + MyBatis Plus
- Neo4j Graph Database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.3</version>
<version>3.5.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.touhouqing</groupId>
Expand All @@ -28,8 +28,8 @@
</scm>
<properties>
<java.version>17</java.version>
<spring-ai.version>1.0.0</spring-ai.version>
<spring-ai-alibaba.version>1.0.0.2</spring-ai-alibaba.version>
<spring-ai.version>1.0.2</spring-ai.version>
<spring-ai-alibaba.version>1.0.0.4</spring-ai-alibaba.version>
</properties>
<dependencies>
<dependency>
Expand All @@ -42,10 +42,10 @@
<artifactId>spring-ai-alibaba-starter-dashscope</artifactId>
</dependency>
<!-- 保留Spring AI的Ollama支持 -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-model-ollama</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.ai</groupId>-->
<!-- <artifactId>spring-ai-starter-model-ollama</artifactId>-->
<!-- </dependency>-->
<!-- 保留Spring AI的向量存储和文档读取器 -->
<dependency>
<groupId>org.springframework.ai</groupId>
Expand All @@ -72,7 +72,7 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>3.5.12</version>
<version>3.5.14</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand All @@ -88,6 +88,11 @@
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.19.0</version>
</dependency>
<dependency>
<groupId>us.codecraft</groupId>
<artifactId>webmagic-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
/*
* Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.touhouqing.chatAiDemo;

import org.mybatis.spring.annotation.MapperScan;
Expand Down
Loading