Upload 15 files
Browse files- .gitignore +1 -0
- Dockerfile +22 -22
- api/utils.py +2 -0
- docker-compose.yml +11 -0
- readme.md +3 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
**/__pycache__/
|
Dockerfile
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
# 使用官方Python基础镜像
|
2 |
-
FROM python:3.12.5-slim
|
3 |
-
|
4 |
-
# 设置工作目录
|
5 |
-
WORKDIR /app
|
6 |
-
|
7 |
-
# 复制依赖文件到工作目录
|
8 |
-
COPY requirements.txt .
|
9 |
-
|
10 |
-
# 安装依赖
|
11 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
-
|
13 |
-
# 复制应用程序代码到容器中
|
14 |
-
COPY . .
|
15 |
-
|
16 |
-
# 暴露端口(根据你的应用程序监听的端口调整)
|
17 |
-
EXPOSE 8001
|
18 |
-
|
19 |
-
# 设置环境变量(例子)
|
20 |
-
ENV APP_SECRET=Rfym21
|
21 |
-
|
22 |
-
# 运行应用程序的命令
|
23 |
CMD ["python", "main.py"]
|
|
|
1 |
+
# 使用官方Python基础镜像
|
2 |
+
FROM python:3.12.5-slim
|
3 |
+
|
4 |
+
# 设置工作目录
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# 复制依赖文件到工作目录
|
8 |
+
COPY requirements.txt .
|
9 |
+
|
10 |
+
# 安装依赖
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
# 复制应用程序代码到容器中
|
14 |
+
COPY . .
|
15 |
+
|
16 |
+
# 暴露端口(根据你的应用程序监听的端口调整)
|
17 |
+
EXPOSE 8001
|
18 |
+
|
19 |
+
# 设置环境变量(例子)
|
20 |
+
ENV APP_SECRET=Rfym21
|
21 |
+
|
22 |
+
# 运行应用程序的命令
|
23 |
CMD ["python", "main.py"]
|
api/utils.py
CHANGED
@@ -80,6 +80,7 @@ async def process_streaming_response(request: ChatRequest):
|
|
80 |
"visitFromDelta": False,
|
81 |
"mobileClient": False,
|
82 |
"userSelectedModel": MODEL_MAPPING.get(request.model),
|
|
|
83 |
}
|
84 |
|
85 |
async with httpx.AsyncClient() as client:
|
@@ -132,6 +133,7 @@ async def process_non_streaming_response(request: ChatRequest):
|
|
132 |
"visitFromDelta": False,
|
133 |
"mobileClient": False,
|
134 |
"userSelectedModel": MODEL_MAPPING.get(request.model),
|
|
|
135 |
}
|
136 |
full_response = ""
|
137 |
async with httpx.AsyncClient() as client:
|
|
|
80 |
"visitFromDelta": False,
|
81 |
"mobileClient": False,
|
82 |
"userSelectedModel": MODEL_MAPPING.get(request.model),
|
83 |
+
"validated": '69783381-2ce4-4dbd-ac78-35e9063feabc'
|
84 |
}
|
85 |
|
86 |
async with httpx.AsyncClient() as client:
|
|
|
133 |
"visitFromDelta": False,
|
134 |
"mobileClient": False,
|
135 |
"userSelectedModel": MODEL_MAPPING.get(request.model),
|
136 |
+
"validated": '69783381-2ce4-4dbd-ac78-35e9063feabc'
|
137 |
}
|
138 |
full_response = ""
|
139 |
async with httpx.AsyncClient() as client:
|
docker-compose.yml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: '3.8' # 定义使用的Compose文件版本
|
2 |
+
|
3 |
+
services:
|
4 |
+
blackbox2api:
|
5 |
+
image: snailyc/blackbox2api # 指定镜像和版本
|
6 |
+
container_name: blackbox2api # 指定容器名称
|
7 |
+
ports:
|
8 |
+
- "8440:8001" # 端口映射
|
9 |
+
environment:
|
10 |
+
- APP_SECRET=Rfym21 # 设置环境变量
|
11 |
+
restart: unless-stopped # 配置重启策略
|
readme.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# docker
|
2 |
+
|
3 |
+
- docker run -d --name blackbox2api -p 8440:8001 -e APP_SECRET=Rfym21 snailyc/blackbox2api:latest
|