Browse Source

统一一下req对象对应的类型

liwei 1 month ago
parent
commit
892e4fba2a
1 changed files with 3 additions and 3 deletions
  1. 3 3
      cli/asynctask/asynctask.go

+ 3 - 3
cli/asynctask/asynctask.go

@@ -323,8 +323,8 @@ func (me *AsyncTask) requestAPI(taskData *ent.CompapiAsynctask) (int, error) {
 		err     error
 		apiResp *types.CompOpenApiResp
 	)
-	req := types.CompApiReq{}
-	if err = json.Unmarshal([]byte(taskData.RequestRaw), &req); err != nil {
+	req := &types.CompApiReq{}
+	if err = json.Unmarshal([]byte(taskData.RequestRaw), req); err != nil {
 		return 0, err
 	}
 	//初始化client
@@ -340,7 +340,7 @@ func (me *AsyncTask) requestAPI(taskData *ent.CompapiAsynctask) (int, error) {
 		case <-me.ctx.Done(): //接到信号退出
 			goto endloopTry
 		default:
-			apiResp, err = client.Chat(&req)
+			apiResp, err = client.Chat(req)
 			if err == nil && apiResp != nil && len(apiResp.Choices) > 0 {
 				//call succ
 				goto endloopTry