mirror of
https://gitee.com/lucinox/dsapi_pub.git
synced 2026-12-07 02:55:00 +08:00
public_version_261205
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
# DSapi
|
||||
|
||||
DeepSeek 代理聊天 + OpenAI 风格对外 API(实验自用,生产级实现标准)。
|
||||
|
||||
## 技术栈
|
||||
|
||||
- 前端:纯 HTML / CSS / JS(`src/main/resources/static`)
|
||||
- 后端:Java 17 + Spring Boot 3.2
|
||||
- 数据库:MySQL 5.7
|
||||
- 浏览器自动化:Playwright
|
||||
|
||||
## 数据库
|
||||
|
||||
默认连接(见 `src/main/resources/application.yml`):
|
||||
|
||||
- 主机:`your_ip:3306`
|
||||
- 库名:`dsapi`
|
||||
- 用户:`root`
|
||||
- Schema 真相源:根目录 `init-mysql.sql`(与 `local-dev/sql/01-schema-mysql.sql` 同步;`ddl-auto=validate`)
|
||||
|
||||
### 首次建库
|
||||
|
||||
执行根目录 `init-mysql.sql`:
|
||||
|
||||
```bash
|
||||
mysql -h your_ip -P 3306 -u root -p < init-mysql.sql
|
||||
```
|
||||
|
||||
## 快速启动
|
||||
|
||||
```bash
|
||||
# 1. 安装 Chromium(首次)
|
||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install chromium"
|
||||
|
||||
# 2. 确认 MySQL 已建库且表结构就绪(见上方)
|
||||
|
||||
# 3. 启动
|
||||
mvn spring-boot:run
|
||||
```
|
||||
|
||||
浏览器访问:http://localhost:10001/
|
||||
默认超管:`admin` / `123456`(若库中已有迁移用户则沿用原数据)
|
||||
|
||||
### DeepSeek 登录(接口设置)
|
||||
|
||||
1. **方案2(推荐)**:点「打开登录窗口」→ 在弹出的 Chromium 里登录 → 回本系统点「我已登录」(无需 Cookie JSON)。
|
||||
成功后状态应为「已登录·可聊天」;聊天失败若仅提示输入框未就绪,**不会再误清登录态**。
|
||||
2. **方案1**:填写账号密码后自动填表;若需人机验证,在弹出窗口完成,再点「我已完成验证」。
|
||||
|
||||
### 无 GUI Linux 部署提示
|
||||
|
||||
Playwright Chromium 跑在**服务器本机**,不是管理员电脑。无桌面环境请用 **headless**;首次 DeepSeek 登录建议:在 Windows 本机方案2登录成功后,复制 `data/deepseek-storage.json` **全文**,到 Linux 超管「接口设置 → 导入 deepseek-storage.json」粘贴导入(不要只粘 Cookie)。详见接口手册第 0 节。
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install -y openjdk-17-jdk maven git \
|
||||
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 \
|
||||
libdrm2 libdbus-1-3 libxkbcommon0 libxcomposite1 libxdamage1 \
|
||||
libxfixes3 libxrandr2 libgbm1 libasound2 libpango-1.0-0 \
|
||||
libcairo2 libatspi2.0-0 libxshmfence1
|
||||
|
||||
sudo mkdir -p /opt/dsapi && sudo chown -R $USER:$USER /opt/dsapi
|
||||
cd /opt/dsapi
|
||||
# ……上传或 git clone 项目到此目录……
|
||||
|
||||
# 先完成 MySQL 建库/迁移,再打包启动
|
||||
mvn -DskipTests package
|
||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install chromium"
|
||||
mkdir -p data
|
||||
nohup java -jar target/dsapi-1.0.0.jar > dsapi.log 2>&1 &
|
||||
```
|
||||
Reference in New Issue
Block a user