Skip to content

Commit 44a8643

Browse files
committed
refactor(main.py): 重构资源路径读取
1 parent fa914f1 commit 44a8643

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

Diff for: README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,18 @@
3232
docker run -p 8000:8000 pig4cloud/markitdown
3333
```
3434

35-
### 2. 使用阿里云百炼平台
35+
### 2. 使用Gitee AI
36+
37+
```bash
38+
docker run -d \
39+
-p 8000:8000 \
40+
-e API_KEY=gitee_ai_key \
41+
-e MODEL=InternVL2_5-26B \
42+
-e BASE_URL=https://ai.gitee.com/v1 \
43+
pig4cloud/markitdown
44+
```
45+
46+
### 3. 使用阿里云百炼平台
3647

3748
```bash
3849
docker run -d \

Diff for: app/banner.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
+------------------------------------------------+
2+
| |
3+
| 🚀 MarkItDown API Server |
4+
| |
5+
| ✨ Server is running... |
6+
| |
7+
| 🌐 http://localhost:8000/docs |
8+
| |
9+
| 🤖 https://ai.pig4cloud.com |
10+
| |
11+
+------------------------------------------------+

Diff for: main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
@asynccontextmanager
1111
async def lifespan(app: FastAPI):
1212
# 启动时执行
13-
banner_path = Path(__file__).parent / 'banner.txt'
13+
current_dir = Path(__file__).parent
14+
banner_path = current_dir / 'app' / 'banner.txt'
15+
print(f"Looking for banner at: {banner_path.absolute()}")
1416
try:
1517
with open(banner_path, 'r', encoding='utf-8') as f:
1618
banner = f.read()
1719
print(banner)
1820
except FileNotFoundError:
19-
print("Banner file not found, starting server without banner...")
21+
print(f"Banner file not found at {banner_path}, starting server without banner...")
2022
yield
2123

2224
def create_app() -> FastAPI:

0 commit comments

Comments
 (0)