|
@@ -98,10 +98,12 @@ func AIGCBaseOnPromote(aigc AIGC) (resp bus_response.AIGCEtaResponse, err error)
|
|
|
err = fmt.Errorf("创建文章文件失败,err: %v", fileErr)
|
|
|
return
|
|
|
}
|
|
|
+ file, err = os.Open(path)
|
|
|
defer func() {
|
|
|
- _ = os.Remove(path)
|
|
|
+ _ = file.Close()
|
|
|
+ err = os.Remove(path)
|
|
|
+ fmt.Println(err)
|
|
|
}()
|
|
|
- file, err = os.Open(path)
|
|
|
if err != nil {
|
|
|
utils.FileLog.Error("打开文件失败,err:", err)
|
|
|
return
|
|
@@ -188,14 +190,16 @@ func AIGCBaseOnPromote(aigc AIGC) (resp bus_response.AIGCEtaResponse, err error)
|
|
|
err = fmt.Errorf("创建文章文件失败,err: %v", fileErr)
|
|
|
return
|
|
|
}
|
|
|
- defer func() {
|
|
|
- _ = os.Remove(path)
|
|
|
- }()
|
|
|
+
|
|
|
file, err = os.Open(path)
|
|
|
if err != nil {
|
|
|
utils.FileLog.Error("打开文件失败,err:", err)
|
|
|
return
|
|
|
}
|
|
|
+ defer func() {
|
|
|
+ _ = file.Close()
|
|
|
+ _ = os.Remove(path)
|
|
|
+ }()
|
|
|
_, httpErr = llmService.UploadFileToTemplate([]*os.File{file}, param)
|
|
|
if httpErr != nil {
|
|
|
utils.FileLog.Error("上传文件失败,err:", err.Error())
|