🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
fix: invoice ocr assistant
huang-jldcea8b71c8c6
diff --git a/metagpt/roles/invoice_ocr_assistant.py b/metagpt/roles/invoice_ocr_assistant.pyindex a39a48b97..afcc527a3 100644--- a/metagpt/roles/invoice_ocr_assistant.py+++ b/metagpt/roles/invoice_ocr_assistant.py@@ -80,19 +80,17 @@ class InvoiceOCRAssistant(Role):raise Exception("Invoice file not uploaded")resp = await todo.run(file_path)+ actions = list(self.actions)if len(resp) == 1:# Single file support for questioning based on OCR recognition results- self.set_actions([GenerateTable, ReplyQuestion])+ actions.extend([GenerateTable, ReplyQuestion])self.orc_data = resp[0]else:- self.set_actions([GenerateTable])-- self.set_todo(None)+ actions.append(GenerateTable)+ self.set_actions(actions)+ self.rc.max_react_loop = len(self.actions)content = INVOICE_OCR_SUCCESSresp = OCRResults(ocr_result=json.dumps(resp))- msg = Message(content=content, instruct_content=resp)- self.rc.memory.add(msg)- return await super().react()elif isinstance(todo, GenerateTable):ocr_results: OCRResults = msg.instruct_contentresp = await todo.run(json.loads(ocr_results.ocr_result), self.filename)