BOHE commited on
Commit
3683948
·
1 Parent(s): 640c0cb
Files changed (1) hide show
  1. 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 `json:"uuid"`
159
  }
160
 
161
  // UploadResponse 定义了文件上传的响应结构
@@ -618,11 +618,16 @@ func getNonce(dsToken string) (*NonceResponse, error) {
618
  }
619
  defer resp.Body.Close()
620
 
621
- var nonceResp NonceResponse
622
- if err := json.NewDecoder(resp.Body).Decode(&nonceResp); err != nil {
623
- return nil, err
 
624
  }
625
- return &nonceResp, nil
 
 
 
 
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
  // 上传文件