| | |
| | | inputs["Question_Difficulty"] = receive_message["difficulty"] |
| | | if "is_paper" in receive_message: |
| | | inputs["Generate_test_paper"] = receive_message["is_paper"] |
| | | if "single_choices" in receive_message: |
| | | if "single_choice" in receive_message: |
| | | inputs["Multiple_choice_questions"] = receive_message["single_choice"] |
| | | if "gap_filling" in receive_message: |
| | | inputs["Fill_in_blank"] = receive_message["gap_filling"] |
| | | if "true_or_false" in receive_message: |
| | | inputs["true_or_false"] = receive_message["true_or_false"] |
| | | if "multiple_choices" in receive_message: |
| | | if "multiple_choice" in receive_message: |
| | | inputs["Multiple_Choice"] = receive_message["multiple_choice"] |
| | | if "easy_questions" in receive_message: |
| | | if "easy_question" in receive_message: |
| | | inputs["Short_Answer_Questions"] = receive_message["easy_question"] |
| | | if "case_questions" in receive_message: |
| | | inputs["Case_Questions"] = receive_message["case_questions"] |
| | |
| | | }) |
| | | if files: |
| | | inputs["upload_files"] = files |
| | | # print(inputs) |
| | | if not question and not inputs: |
| | | await websocket.send_json({"message": "Invalid request", "type": "error"}) |
| | | continue |
| | |
| | | complete_response += rag_response |
| | | try: |
| | | data = json.loads(complete_response) |
| | | print(data) |
| | | # print(data) |
| | | if data.get("event") == "node_started" or data.get( |
| | | "event") == "node_finished": # "event": "message_end" |
| | | if "data" not in data or not data["data"]: # 信息过滤 |
| | |
| | | outputs = answer.get("outputs", {}) |
| | | if outputs: |
| | | message = outputs.get("answer", "") |
| | | # download_url = outputs.get("download_url", "") |
| | | download_url = outputs.get("download_url", "") |
| | | else: |
| | | message = answer.get("error", "") |
| | | |