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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
| import { z } from "zod";
| import type { ProviderConfig } from "@humansignal/app-common/blocks/StorageProviderForm/types/provider";
| import { IconCloudProviderS3 } from "@humansignal/icons";
|
| export const s3Provider: ProviderConfig = {
| name: "s3",
| title: "Amazon S3",
| description: "配置您的 AWS S3 连接以及所有必需的 Label Studio 设置",
| icon: IconCloudProviderS3,
| fields: [
| {
| name: "bucket",
| type: "text",
| label: "存储桶名称 (Bucket Name)",
| required: true,
| placeholder: "my-storage-bucket",
| schema: z.string().min(1, "Bucket name is required"),
| },
| {
| name: "region_name",
| type: "text",
| label: "区域名称 (Region Name)",
| placeholder: "us-east-1 (default)",
| schema: z.string().optional().default(""),
| },
| {
| name: "s3_endpoint",
| type: "text",
| label: "S3 端点 (S3 Endpoint)",
| placeholder: "https://s3.amazonaws.com (default)",
| schema: z.string().optional().default(""),
| },
| {
| name: "prefix",
| type: "text",
| label: "存储桶前缀 (Bucket prefix)",
| placeholder: "文件路径",
| schema: z.string().optional().default(""),
| target: "export",
| },
| {
| name: "aws_access_key_id",
| type: "password",
| label: "访问密钥 ID (Access Key ID)",
| required: true,
| placeholder: "AKIAIOSFODNN7EXAMPLE",
| autoComplete: "off",
| accessKey: true,
| schema: z.string().min(1, "Access Key ID is required"),
| },
| {
| name: "aws_secret_access_key",
| type: "password",
| label: "秘密访问密钥 (Secret Access Key)",
| required: true,
| placeholder: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
| autoComplete: "new-password",
| accessKey: true,
| schema: z.string().min(1, "Secret Access Key is required"),
| },
| {
| name: "aws_session_token",
| type: "password",
| label: "会话令牌 (Session Token)",
| placeholder: "会话令牌(可选)",
| autoComplete: "new-password",
| schema: z.string().optional().default(""),
| },
| {
| name: "presign",
| type: "toggle",
| label: "使用预签名 URL (开) / 通过平台代理 (关)",
| description:
| "启用预签名 URL 时,所有数据都将绕过平台,用户浏览器将直接从存储中读取数据",
| schema: z.boolean().default(true),
| target: "import",
| resetConnection: false,
| },
| {
| name: "presign_ttl",
| type: "counter",
| label: "预签名 URL 有效期(分钟)",
| min: 1,
| max: 10080,
| step: 1,
| schema: z.number().min(1).max(10080).default(15),
| target: "import",
| resetConnection: false,
| dependsOn: {
| field: "presign",
| value: true,
| },
| },
| ],
| layout: [
| { fields: ["bucket"] },
| { fields: ["region_name"] },
| { fields: ["s3_endpoint"] },
| { fields: ["prefix"] },
| { fields: ["aws_access_key_id"] },
| { fields: ["aws_secret_access_key"] },
| { fields: ["aws_session_token"] },
| { fields: ["presign", "presign_ttl"] },
| ],
| };
|
|