| | |
| | | logger.error("---------------------excel_talk-----------------------------") |
| | | excel_url = "" |
| | | image_url = "" |
| | | image_name = "" |
| | | excel_name = "" |
| | | async for data in service.excel_talk(question, chat_id): |
| | | # logger.error(data) |
| | | output = data.get("output", "") |
| | | excel_name = data.get("excel_name", "") |
| | | image_name = data.get("image_name", "") |
| | | e_name = data.get("excel_name", "") |
| | | i_name = data.get("image_name", "") |
| | | |
| | | def build_file_url(name, file_type): |
| | | if not name: |
| | | return None |
| | | return (f"/api/files/download/?agent_id={agent_id}&file_id={name}" |
| | | f"&file_type={file_type}") |
| | | if excel_name: |
| | | excel_url = build_file_url(excel_name, 'excel') |
| | | if image_name: |
| | | image_url = build_file_url(image_name, 'image') |
| | | if e_name: |
| | | excel_url = build_file_url(e_name, 'excel') |
| | | excel_name = e_name |
| | | if i_name: |
| | | image_url = build_file_url(i_name, 'image') |
| | | image_name = i_name |
| | | if data["type"] == "message": |
| | | message_data = { |
| | | "content": output, |
| | | "excel_url": excel_url, |
| | | "image_url": image_url, |
| | | "image_name": image_name, |
| | | "excel_name": excel_name, |
| | | "sql": data.get("sql", ""), |
| | | "code": data.get("code", ""), |
| | | "e": data.get("e", ""), |