| 
									
										
										
										
											2023-12-18 13:10:05 +08:00
										 |  |  | from flask_restful import fields | 
					
						
							| 
									
										
										
										
											2024-02-06 13:21:13 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-18 13:10:05 +08:00
										 |  |  | from libs.helper import TimestampField | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | annotation_fields = { | 
					
						
							|  |  |  |     "id": fields.String, | 
					
						
							|  |  |  |     "question": fields.String, | 
					
						
							| 
									
										
										
										
											2024-08-15 12:54:05 +08:00
										 |  |  |     "answer": fields.Raw(attribute="content"), | 
					
						
							| 
									
										
										
										
											2023-12-18 13:10:05 +08:00
										 |  |  |     "hit_count": fields.Integer, | 
					
						
							|  |  |  |     "created_at": TimestampField, | 
					
						
							| 
									
										
										
										
											2024-04-08 18:51:46 +08:00
										 |  |  |     # 'account': fields.Nested(simple_account_fields, allow_null=True) | 
					
						
							| 
									
										
										
										
											2023-12-18 13:10:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | annotation_list_fields = { | 
					
						
							|  |  |  |     "data": fields.List(fields.Nested(annotation_fields)), | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | annotation_hit_history_fields = { | 
					
						
							|  |  |  |     "id": fields.String, | 
					
						
							|  |  |  |     "source": fields.String, | 
					
						
							|  |  |  |     "score": fields.Float, | 
					
						
							|  |  |  |     "question": fields.String, | 
					
						
							|  |  |  |     "created_at": TimestampField, | 
					
						
							| 
									
										
										
										
											2024-08-15 12:54:05 +08:00
										 |  |  |     "match": fields.String(attribute="annotation_question"), | 
					
						
							|  |  |  |     "response": fields.String(attribute="annotation_content"), | 
					
						
							| 
									
										
										
										
											2023-12-18 13:10:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | annotation_hit_history_list_fields = { | 
					
						
							|  |  |  |     "data": fields.List(fields.Nested(annotation_hit_history_fields)), | 
					
						
							|  |  |  | } |