Fix error
parent
93d176351e
commit
a8a5a6ec7b
|
|
@ -18,7 +18,7 @@ COPY requirements.txt .
|
|||
# 安装系统依赖、Python依赖,然后清理(一个RUN命令减少层大小)
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
curl \
|
||||
wget \
|
||||
default-libmysqlclient-dev \
|
||||
pkg-config \
|
||||
&& pip install --index-url https://mirrors.aliyun.com/pypi/simple --no-cache-dir -r requirements.txt \
|
||||
|
|
|
|||
|
|
@ -44,8 +44,6 @@ class UpdateExternalAppRequest(BaseModel):
|
|||
async def get_external_apps(
|
||||
app_type: Optional[str] = None,
|
||||
is_active: Optional[bool] = None,
|
||||
page: int = 1,
|
||||
size: int = 50,
|
||||
current_user: dict = Depends(get_current_admin_user)
|
||||
):
|
||||
"""
|
||||
|
|
@ -75,16 +73,14 @@ async def get_external_apps(
|
|||
total = cursor.fetchone()['total']
|
||||
|
||||
# 获取列表数据
|
||||
offset = (page - 1) * size
|
||||
list_query = f"""
|
||||
SELECT ea.*, u.username as creator_username
|
||||
FROM external_apps ea
|
||||
LEFT JOIN users u ON ea.created_by = u.user_id
|
||||
WHERE {where_clause}
|
||||
ORDER BY ea.sort_order ASC, ea.created_at DESC
|
||||
LIMIT %s OFFSET %s
|
||||
"""
|
||||
cursor.execute(list_query, params + [size, offset])
|
||||
cursor.execute(list_query, params)
|
||||
apps = cursor.fetchall()
|
||||
|
||||
# 解析 app_info JSON
|
||||
|
|
@ -100,12 +96,7 @@ async def get_external_apps(
|
|||
return create_api_response(
|
||||
code="200",
|
||||
message="获取成功",
|
||||
data={
|
||||
"apps": apps,
|
||||
"total": total,
|
||||
"page": page,
|
||||
"size": size
|
||||
}
|
||||
data=apps
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -13,13 +13,16 @@ import uvicorn
|
|||
from fastapi import FastAPI, Request, HTTPException
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.openapi.docs import get_swagger_ui_html
|
||||
from app.api.endpoints import auth, users, meetings, tags, admin, admin_dashboard, tasks, prompts, knowledge_base, client_downloads, voiceprint, audio, dict_data, hot_words, external_apps
|
||||
from app.core.config import UPLOAD_DIR, API_CONFIG
|
||||
|
||||
app = FastAPI(
|
||||
title="iMeeting API",
|
||||
description="智慧会议系统API",
|
||||
version="1.0.2"
|
||||
description="iMeeting API说明",
|
||||
version="1.1.0",
|
||||
docs_url=None, # 禁用默认docs,使用自定义CDN
|
||||
redoc_url=None
|
||||
)
|
||||
|
||||
# 添加CORS中间件
|
||||
|
|
@ -52,6 +55,17 @@ app.include_router(voiceprint.router, prefix="/api", tags=["Voiceprint"])
|
|||
app.include_router(audio.router, prefix="/api", tags=["Audio"])
|
||||
app.include_router(hot_words.router, prefix="/api", tags=["HotWords"])
|
||||
|
||||
@app.get("/docs", include_in_schema=False)
|
||||
async def custom_swagger_ui_html():
|
||||
"""自定义Swagger UI,使用国内可访问的CDN"""
|
||||
return get_swagger_ui_html(
|
||||
openapi_url=app.openapi_url,
|
||||
title=app.title + " - Swagger UI",
|
||||
oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
|
||||
swagger_js_url="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-bundle.js",
|
||||
swagger_css_url="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui.css",
|
||||
)
|
||||
|
||||
@app.get("/")
|
||||
def read_root():
|
||||
return {"message": "Welcome to iMeeting API"}
|
||||
|
|
@ -62,7 +76,7 @@ def health_check():
|
|||
return {
|
||||
"status": "healthy",
|
||||
"service": "iMeeting API",
|
||||
"version": "1.0.2"
|
||||
"version": "1.1.0"
|
||||
}
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@ services:
|
|||
environment:
|
||||
# Python环境
|
||||
TZ: Asia/Shanghai
|
||||
PYTHONPATH: /app
|
||||
PYTHONUNBUFFERED: 1
|
||||
|
||||
# 数据库配置
|
||||
DB_HOST: mysql
|
||||
|
|
@ -105,7 +103,7 @@ services:
|
|||
- ./data/uploads:/app/uploads
|
||||
- ./data/logs/backend:/app/logs
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ const ExternalAppManagement = ({ user }) => {
|
|||
setLoading(true);
|
||||
try {
|
||||
const response = await apiClient.get(buildApiUrl(API_ENDPOINTS.EXTERNAL_APPS.LIST));
|
||||
setApps(response.data.apps || []);
|
||||
setApps(response.data || []);
|
||||
} catch (error) {
|
||||
console.error('获取外部应用列表失败:', error);
|
||||
showToast('获取外部应用列表失败', 'error');
|
||||
|
|
|
|||
Loading…
Reference in New Issue