less: replicate log
This commit is contained in:
@@ -190,14 +190,10 @@ func _processReplicateRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record
|
|||||||
|
|
||||||
// parse chunk to ReplicateModelResultChunk object
|
// parse chunk to ReplicateModelResultChunk object
|
||||||
chunkObj := &ReplicateModelResultChunk{}
|
chunkObj := &ReplicateModelResultChunk{}
|
||||||
log.Println("[processReplicateRequest]: chunk:", chunk)
|
|
||||||
lines := strings.Split(chunk, "\n")
|
lines := strings.Split(chunk, "\n")
|
||||||
log.Println("[processReplicateRequest]: lines:", lines)
|
|
||||||
// first line is event
|
// first line is event
|
||||||
chunkObj.Event = strings.TrimSpace(lines[0])
|
chunkObj.Event = strings.TrimSpace(lines[0])
|
||||||
chunkObj.Event = strings.TrimPrefix(chunkObj.Event, "event: ")
|
chunkObj.Event = strings.TrimPrefix(chunkObj.Event, "event: ")
|
||||||
fmt.Printf("[processReplicateRequest]: chunkObj.Event: '%s'\n", chunkObj.Event)
|
|
||||||
fmt.Printf("Length: %d\n", len(chunkObj.Event))
|
|
||||||
// second line is id
|
// second line is id
|
||||||
chunkObj.ID = strings.TrimSpace(lines[1])
|
chunkObj.ID = strings.TrimSpace(lines[1])
|
||||||
chunkObj.ID = strings.TrimPrefix(chunkObj.ID, "id: ")
|
chunkObj.ID = strings.TrimPrefix(chunkObj.ID, "id: ")
|
||||||
@@ -277,8 +273,6 @@ func _processReplicateRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record
|
|||||||
return errors.New("[processReplicateRequest]: failed to read response body " + err.Error())
|
return errors.New("[processReplicateRequest]: failed to read response body " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("[processReplicateRequest]: resultBody:", string(resultBody))
|
|
||||||
|
|
||||||
// parse reponse body
|
// parse reponse body
|
||||||
result = &ReplicateModelResultGet{}
|
result = &ReplicateModelResultGet{}
|
||||||
err = json.Unmarshal(resultBody, result)
|
err = json.Unmarshal(resultBody, result)
|
||||||
@@ -286,7 +280,6 @@ func _processReplicateRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record
|
|||||||
c.Request.Body = io.NopCloser(bytes.NewBuffer(inBody))
|
c.Request.Body = io.NopCloser(bytes.NewBuffer(inBody))
|
||||||
return errors.New("[processReplicateRequest]: failed to parse response body " + err.Error())
|
return errors.New("[processReplicateRequest]: failed to parse response body " + err.Error())
|
||||||
}
|
}
|
||||||
log.Println("[processReplicateRequest]: result:", result)
|
|
||||||
|
|
||||||
if result.Status == "processing" || result.Status == "starting" {
|
if result.Status == "processing" || result.Status == "starting" {
|
||||||
time.Sleep(3 * time.Second)
|
time.Sleep(3 * time.Second)
|
||||||
|
|||||||
Reference in New Issue
Block a user