Spaces:
Configuration error
Configuration error
BOHE
commited on
Commit
·
3683948
1
Parent(s):
640c0cb
测试
Browse files- api/main.go +10 -5
api/main.go
CHANGED
|
@@ -155,7 +155,7 @@ var originalModel string
|
|
| 155 |
|
| 156 |
// NonceResponse 定义了获取 nonce 的响应结构
|
| 157 |
type NonceResponse struct {
|
| 158 |
-
Uuid string
|
| 159 |
}
|
| 160 |
|
| 161 |
// UploadResponse 定义了文件上传的响应结构
|
|
@@ -618,11 +618,16 @@ func getNonce(dsToken string) (*NonceResponse, error) {
|
|
| 618 |
}
|
| 619 |
defer resp.Body.Close()
|
| 620 |
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
|
|
|
| 624 |
}
|
| 625 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 626 |
}
|
| 627 |
|
| 628 |
// 上传文件
|
|
|
|
| 155 |
|
| 156 |
// NonceResponse 定义了获取 nonce 的响应结构
|
| 157 |
type NonceResponse struct {
|
| 158 |
+
Uuid string
|
| 159 |
}
|
| 160 |
|
| 161 |
// UploadResponse 定义了文件上传的响应结构
|
|
|
|
| 618 |
}
|
| 619 |
defer resp.Body.Close()
|
| 620 |
|
| 621 |
+
// 读取完整的响应内容
|
| 622 |
+
body, err := io.ReadAll(resp.Body)
|
| 623 |
+
if err != nil {
|
| 624 |
+
return nil, fmt.Errorf("读取响应失败: %v", err)
|
| 625 |
}
|
| 626 |
+
|
| 627 |
+
// 直接使用响应内容作为 UUID
|
| 628 |
+
return &NonceResponse{
|
| 629 |
+
Uuid: strings.TrimSpace(string(body)),
|
| 630 |
+
}, nil
|
| 631 |
}
|
| 632 |
|
| 633 |
// 上传文件
|