AI prompts
base on 中国裁判文书网本地搜索 # cases
中国裁判文书网搜索
## 用法
> [!CAUTION]
> 需要磁盘空间 320G 以上,可能需要数小时的时间
> [!WARNING]
> 在 Linux 平台,如果出现 `IO error: ……Too many open files`,可以使用`ulimit -n 10000`命令提高文件描述符上限。
### 0. 下载程序并创建配置文件
方法一:从 releases 页面下载已编译好的二进制文件(推荐),https://github.com/cncases/cases/releases
方法二:自行编译
```bash
## 安装 rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
## clone 本仓库
git clone https://github.com/cncases/cases.git
## 编译,对应程序在 target/release/ 文件夹中
cargo build -r
```
配置文件参考[config.toml](./config.toml)
### 1. 下载原始数据(102G)
方法:通过bt下载,种子文件为 `810air.torrent` ,可以从本[仓库](./810air.torrent)下载,也可以通过链接 https://files.catbox.moe/810air.torrent
原始数据来源于[马克数据网](https://www.macrodatas.cn/article/1147471898),文书数量超过8500万,约102G。下载后**不要**解压子文件,将文件路径填写到 `config.toml` 中的 `raw_data_path` 变量中;
### 2. 将数据加载到 rocksdb 数据库中
运行 `convert config.toml` 程序。此过程会将原始数据放入 rocksdb 数据库中,数据库文件路径为 `config.toml` 中的 `db` 变量;转换后的数据大小约为 200G,转换可能会花费数小时的时间;如果中途中断,再次运行会从中断处继续。
### 3. 创建索引
运行 `index config.toml` 程序会将数据库中的数据创建索引,索引文件路径为 `config.toml` 中的 `index_path` 变量;如果中途中断,需要删除 `index_path` 中的文件,重新运行 `index` 程序;默认情况下,不会索引案件内容,索引大小约为 15.5G,可能会花费数小时的时间。如果需要索引案件内容,需要将index.toml中的 `index_with_full_text` 设置为 `true`,但是这会使索引文件增加到150G左右,索引时间也会增加到十几个小时。
### 4. 运行搜索服务
运行 `main config.toml` 程序,用浏览器打开`config.toml`网址,即可搜索。
## 说明
当程序和配置文件放在同一目录下,且配置文件命名为 `config.toml` 时,可以省略配置文件路径参数。
![screenshot](Screenshot.png)
", Assign "at most 3 tags" to the expected json: {"id":"7124","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"