Browse Source

modify network test

highing666 4 years ago
parent
commit
57cfe52aef
2 changed files with 4 additions and 3 deletions
  1. 4 0
      app/api/routers/nlp.py
  2. 0 3
      app/controllers/nlp/meeting.py

+ 4 - 0
app/api/routers/nlp.py

@@ -1,4 +1,6 @@
+import httpx
 from fastapi import APIRouter, Query
+from loguru import logger
 
 from app.controllers.nlp.meeting import get_caught_result
 from app.models.domain.nlp import MeetingInfoResponse
@@ -8,6 +10,8 @@ router = APIRouter()
 
 @router.get('/meeting/info', response_model=MeetingInfoResponse)
 async def catch_meeting_info(sentence: str = Query(..., max_length=100)):
+    r = httpx.get('https://api.github.com/users/octocat/orgs')  # Test external network
+    logger.debug(r.status_code)
     start_time, end_time, duration, room_size, topic, name_list = await get_caught_result(sentence)
     response = {
         'Message': 'success',

+ 0 - 3
app/controllers/nlp/meeting.py

@@ -78,8 +78,5 @@ async def get_caught_result(sentence: str) -> Tuple:
         duckling = Duckling(client)
         service = TencentNLP()
 
-        r = await client.get('https://api.github.com/users/octocat/orgs')  # Test external network
-        logger.debug(r.status_code)
-
         catcher = MeetingInfoCatcher(service, duckling)
         return await catcher.run(sentence)