-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathfile.py
More file actions
54 lines (45 loc) · 1.61 KB
/
file.py
File metadata and controls
54 lines (45 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter
from common.mixins.api_mixin import APIMixin
from common.result import DefaultResultSerializer
class FileUploadAPI(APIMixin):
@staticmethod
def get_request():
return {
'multipart/form-data': {
'type': 'object',
'properties': {
'file': {
'type': 'string',
'format': 'binary',
'description': '要上传的文件'
},
"source_id": {
'type': 'string',
'description': '资源id 如果source_type为[TEMPORARY_30_MINUTE,TEMPORARY_120_MINUTE,TEMPORARY_1_DAY,SYSTEM] 其他的需要为对应资源的id'
},
"source_type": {
'type': 'string',
'description': '资源类型[KNOWLEDGE,APPLICATION,TOOL,DOCUMENT,CHAT,SYSTEM,TEMPORARY_30_MINUTE,TEMPORARY_120_MINUTE,TEMPORARY_1_DAY]'
}
}
}
}
@staticmethod
def get_response():
return DefaultResultSerializer
class FileGetAPI(APIMixin):
@staticmethod
def get_parameters():
return [
OpenApiParameter(
name="file_id",
description="文件id",
type=OpenApiTypes.STR,
location='path',
required=True,
),
]
@staticmethod
def get_response():
return DefaultResultSerializer