From 69b9ce76bf59da2c1382d0e00162590233982a52 Mon Sep 17 00:00:00 2001
From: Huu Le <39040748+leehuwuj@users.noreply.github.com>
Date: Fri, 7 Jun 2024 18:46:25 +0700
Subject: [PATCH] refactor code (#119)

---
 .../types/streaming/fastapi/app/api/routers/models.py  | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/templates/types/streaming/fastapi/app/api/routers/models.py b/templates/types/streaming/fastapi/app/api/routers/models.py
index d870b091..fe133daf 100644
--- a/templates/types/streaming/fastapi/app/api/routers/models.py
+++ b/templates/types/streaming/fastapi/app/api/routers/models.py
@@ -15,7 +15,6 @@ class CsvFile(BaseModel):
     filename: str
     filesize: int
     id: str
-    type: str
 
 
 class AnnotationData(BaseModel):
@@ -89,12 +88,11 @@ class ChatData(BaseModel):
         message_content = last_message.content
         for message in reversed(self.messages):
             if message.role == MessageRole.USER and message.annotations is not None:
-                annotation_text = "\n".join(
-                    [
-                        annotation.data.to_raw_content()
-                        for annotation in message.annotations
-                    ]
+                annotation_contents = (
+                    annotation.data.to_raw_content()
+                    for annotation in message.annotations
                 )
+                annotation_text = "\n".join(filter(None, annotation_contents))
                 message_content = f"{message_content}\n{annotation_text}"
                 break
         return message_content
-- 
GitLab