Mbonea commited on
Commit
6c3701c
1 Parent(s): f27f3d5

restore chat router

Browse files
Files changed (2) hide show
  1. App/Chat/ChatRoutes.py +12 -12
  2. App/app.py +1 -1
App/Chat/ChatRoutes.py CHANGED
@@ -1,4 +1,4 @@
1
- from fastapi import APIRouter, Request,Depends
2
  from App.Users.Model import User
3
  from App.Users.UserRoutes import get_token_owner
4
  from App.Users.Schemas import UserSchema
@@ -25,21 +25,21 @@ async def fetch_and_forward_request(request_body):
25
  return response_text, response.status
26
 
27
 
28
- # @chat_router.post("/sql")
29
- # async def generate_message(request_body: str):
30
- # response_body, status_code = await fetch_and_forward_request(request_body)
31
- # return response_body
32
 
33
 
34
  @chat_router.get("/summarize/{task_id}")
35
- async def generate_message( task_id: str,
 
36
  # user: UserSchema = Depends(get_token_owner)
37
- ):
38
  entry: Transcriptions = await Transcriptions.objects.filter(task_id=task_id).first()
39
  result = BaseTranscription(**entry.__dict__)
40
- text =''
 
41
  for item in result.content:
42
- text+=item['text']
43
- summary=await Summarizer(text)
44
- return [summary]
45
-
 
1
+ from fastapi import APIRouter, Request, Depends
2
  from App.Users.Model import User
3
  from App.Users.UserRoutes import get_token_owner
4
  from App.Users.Schemas import UserSchema
 
25
  return response_text, response.status
26
 
27
 
28
+ @chat_router.post("/Chat")
29
+ async def generate_response(request_body: str):
30
+ pass
 
31
 
32
 
33
  @chat_router.get("/summarize/{task_id}")
34
+ async def generate_message(
35
+ task_id: str,
36
  # user: UserSchema = Depends(get_token_owner)
37
+ ):
38
  entry: Transcriptions = await Transcriptions.objects.filter(task_id=task_id).first()
39
  result = BaseTranscription(**entry.__dict__)
40
+ print(result)
41
+ text = ""
42
  for item in result.content:
43
+ text += item["text"]
44
+ summary = await Summarizer(text)
45
+ return [summary]
 
App/app.py CHANGED
@@ -80,4 +80,4 @@ app.include_router(streaming_router)
80
  app.include_router(monitor_router)
81
  app.include_router(user_transcriptions_router)
82
  app.include_router(embeddigs_router)
83
- # app.include_router(chat_router)
 
80
  app.include_router(monitor_router)
81
  app.include_router(user_transcriptions_router)
82
  app.include_router(embeddigs_router)
83
+ app.include_router(chat_router)