-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b629235
commit c24b075
Showing
5 changed files
with
115 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,37 +9,55 @@ | |
|
||
CourseGraph 使用大模型,利用多种 prompt 优化技术, 自动从教材、书籍中抽取知识点, 构成以课程-章节-知识点为主题的知识图谱。为增加每个知识点的信息, CourseGraph 可以为知识点链接相应的习题、扩展阅读材料等资源, 另外也可利用多模态大模型从 pptx、图片、视频中提取信息并与之相关联。 | ||
|
||
|
||
## 🤔局限性 | ||
## 🤔 局限性 | ||
|
||
- 目前只实现了基本的知识图谱抽取和对 pptx 的解析,效果有待优化 | ||
- 对视频的解析还处于规划中 | ||
|
||
## 📈未来发展方向 | ||
## 📈 未来发展方向 | ||
|
||
- 改进提示词工程,并尝试使用 Agent 完成相关工作 | ||
- 基于图谱的问答 (KBQA 或 Graph-RAG) | ||
|
||
## 🚀快速使用 | ||
## 🚀 快速使用 | ||
|
||
首先 [申请阿里云通义千问 API Key](https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key?spm=a2c4g.11186623.0.0.1be847bbvv6p4o),然后选择使用 Docker 安装或本地安装 | ||
|
||
### 方式一:使用 Docker(推荐) | ||
|
||
本项目提供了 Docker 配置,可以快速搭建开发环境: | ||
|
||
```bash | ||
git clone [email protected]:wangtao2001/CourseGraph.git | ||
cd CourseGraph | ||
export DASHSCOPE_API_KEY= | ||
docker-compose -f docker/docker-compose.yml up -d | ||
python examples/get_knowledge_graph.py | ||
``` | ||
|
||
### 方式二:本地安装 | ||
|
||
#### 安装依赖 | ||
|
||
本项目使用 Conda 管理虚拟环境,使用 Poetry 管理 Python 包,另外还使用 Rust + PyO3 编写了部分 Python 扩展,请确保已安装 Anaconda (或Miniconda) 和 Rust 环境,然后执行: | ||
请确保已安装 Anaconda (或 Miniconda) 和 Rust ,然后执行: | ||
|
||
```bash | ||
git clone [email protected]:wangtao2001/CourseGraph.git | ||
cd CourseGraph | ||
source install.sh | ||
conda create -n cg python=3.10 -y | ||
conda activate cg | ||
pip install poetry | ||
poetry config virtualenvs.create false | ||
poetry install | ||
cd rust | ||
maturin develop | ||
cd .. | ||
``` | ||
|
||
> linux 下还需安装 libreoffice 以完成文档转换,以 Debian 系为例: `sudo apt install libreoffice` | ||
然后定位到文件 `examples/get_knowledge_graph.py` 中 | ||
|
||
#### 配置 API Key | ||
|
||
默认使用阿里云通义千问API,需要 [获取API Key](https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key?spm=a2c4g.11186623.0.0.1be847bbvv6p4o) 并 [配置到环境变量](https://help.aliyun.com/zh/model-studio/developer-reference/configure-api-key-through-environment-variables?spm=a2c4g.11186623.0.0.1be87980J3g9io) 中 | ||
|
||
#### 修改图数据库信息 | ||
|
||
图数据库使用 Neo4j,需要提供连接地址和账号密码,如未安装请参考 [Neo4j 文档](https://neo4j.com/docs/operations-manual/current/installation/) | ||
|
@@ -50,7 +68,7 @@ source install.sh | |
python examples/get_knowledge_graph.py | ||
``` | ||
|
||
## 📚文档 | ||
## 📚 文档 | ||
|
||
可以在 `docs` 目录下查看文档, 也可以访问 [在线文档](https://wangtao2001.github.io/CourseGraph/) (由于项目功能仍处于快速开发中,故在线文档暂时还没有准备好)。如果你希望自定义在线文档请依照以下步骤: | ||
|
||
|
@@ -59,6 +77,7 @@ python examples/get_knowledge_graph.py | |
文档使用 [VitePress](https://vitepress.dev/) 构建, 需安装 Node.js 18 或以上版本,然后执行: | ||
|
||
```bash | ||
cd docs | ||
npm i | ||
npm run docs:dev | ||
``` | ||
|
@@ -69,7 +88,7 @@ npm run docs:dev | |
|
||
在线文档使用 Github Actions + Github Pages 部署,描述文件在 `.github/workflows/docs.yaml` | ||
|
||
## 🛠️贡献和引用 | ||
## 🛠️ 贡献和引用 | ||
|
||
欢迎提交 [PR](https://github.com/wangtao2001/CourseGraph/pulls) 或 [Issues](https://github.com/wangtao2001/CourseGraph/issues),也欢迎参与任何形式的贡献 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
FROM ubuntu:22.04 | ||
|
||
# 避免交互式提示 | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# 安装基础工具 | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
git \ | ||
build-essential \ | ||
pkg-config \ | ||
libreoffice \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# 安装 Python | ||
RUN apt-get update && apt-get install -y \ | ||
python3.10 \ | ||
python3-pip \ | ||
python3.10-venv \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# 安装 Rust | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
||
# 安装 Node.js | ||
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ | ||
&& apt-get install -y nodejs \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# 设置工作目录 | ||
WORKDIR /app | ||
|
||
# 复制项目文件 | ||
COPY . . | ||
|
||
# 安装 Python 依赖 | ||
RUN pip3 install poetry \ | ||
&& poetry config virtualenvs.create false \ | ||
&& poetry install | ||
|
||
# 编译 Rust 扩展 | ||
RUN cd rust && maturin develop && cd .. | ||
|
||
# 安装文档依赖 | ||
RUN cd docs && npm install && cd .. | ||
|
||
# 暴露文档服务端口 | ||
EXPOSE 5173 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: '3' | ||
|
||
services: | ||
app: | ||
build: | ||
context: .. | ||
dockerfile: docker/Dockerfile | ||
environment: | ||
- DASHSCOPE_API_KEY=${DASHSCOPE_API_KEY} | ||
- NEO4J_URI=bolt://neo4j:7687 | ||
- NEO4J_USER=neo4j | ||
- NEO4J_PASSWORD=password | ||
ports: | ||
- "5173:5173" | ||
depends_on: | ||
- neo4j | ||
volumes: | ||
- ..:/app | ||
command: tail -f /dev/null # 保持容器运行 | ||
|
||
neo4j: | ||
image: neo4j:5.13.0 | ||
environment: | ||
- NEO4J_AUTH=neo4j/password | ||
ports: | ||
- "7474:7474" # HTTP | ||
- "7687:7687" # Bolt | ||
volumes: | ||
- neo4j_data:/data | ||
- neo4j_logs:/logs | ||
|
||
volumes: | ||
neo4j_data: | ||
neo4j_logs: |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.