Istvan-Adem commited on
Commit
b0d3425
·
1 Parent(s): 22379c6
ocr/api/message/utils.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  from ocr.core.config import settings
2
 
3
 
@@ -9,4 +11,5 @@ async def clean_assistant_response(thread_id: str, run_id: str):
9
  for annotation in annotations:
10
  message_content.value = message_content.value.replace(annotation.text, f"")
11
  result = message_content.value
 
12
  return result
 
1
+ import re
2
+
3
  from ocr.core.config import settings
4
 
5
 
 
11
  for annotation in annotations:
12
  message_content.value = message_content.value.replace(annotation.text, f"")
13
  result = message_content.value
14
+ result = re.search(r'```markdown\s*(.*?)\s*```', result, re.DOTALL).group(1)
15
  return result
ocr/api/message/views.py CHANGED
@@ -11,6 +11,4 @@ async def get_all_chat_messages(
11
  file: UploadFile = File(...)
12
  ) -> OcrResponseWrapper[OcrResponse]:
13
  response = await analyze_uploaded_document(file)
14
- with open('README.md', 'w') as file:
15
- file.write(response)
16
  return OcrResponseWrapper(data=OcrResponse(text=response))
 
11
  file: UploadFile = File(...)
12
  ) -> OcrResponseWrapper[OcrResponse]:
13
  response = await analyze_uploaded_document(file)
 
 
14
  return OcrResponseWrapper(data=OcrResponse(text=response))