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
| import { z } from "zod";
| import type { ProviderConfig } from "@humansignal/app-common/blocks/StorageProviderForm/types/provider";
| import { IconCloudProviderGCS } from "@humansignal/icons";
|
| export const gcsProvider: ProviderConfig = {
| name: "gcs",
| title: "Google 云存储",
| description: "配置您的 Google 云存储连接以及所有必需的 Label Studio 设置",
| icon: IconCloudProviderGCS,
| fields: [
| {
| name: "bucket",
| type: "text",
| label: "存储桶名称 (Bucket Name)",
| required: true,
| schema: z.string().min(1, "Bucket name is required"),
| },
| {
| name: "prefix",
| type: "text",
| label: "存储桶前缀 (Bucket prefix)",
| placeholder: "path/to/files",
| schema: z.string().optional().default(""),
| target: "export",
| },
| {
| name: "google_application_credentials",
| type: "password",
| label: "Google 应用程序凭据",
| description: "将 credentials.json 的内容粘贴到此字段中,或者是留空以使用 ADC。",
| autoComplete: "new-password",
| accessKey: true,
| schema: z.string().optional().default(""), // JSON validation could be added if needed
| },
| {
| name: "google_project_id",
| type: "text",
| label: "Google 项目 ID",
| description: "留空以从 Google 应用程序凭据中继承。",
| 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: ["prefix"] },
| { fields: ["google_application_credentials"] },
| { fields: ["google_project_id"] },
| { fields: ["presign", "presign_ttl"] },
| ],
| };
|
| export default gcsProvider;
|
|