added parse img url to another type for img and varimg
This commit is contained in:
parent
c98076ec10
commit
7897dc2cb1
@ -1,6 +1,7 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/xuri/excelize/v2"
|
||||
_ "image/gif"
|
||||
@ -101,7 +102,12 @@ func WriteDataToExcel(buffer io.Writer, questions []model.Question, answers []mo
|
||||
noAccept := make(map[string]struct{})
|
||||
todoMap := make(map[string]string)
|
||||
if tipe != "Text" && q.Type == model.TypeImages || q.Type == model.TypeVarImages {
|
||||
urle := ExtractImageURL(response[index].Content)
|
||||
var res model.ImageContent
|
||||
err := json.Unmarshal([]byte(response[index].Content), &res)
|
||||
if err != nil {
|
||||
res.Image = response[index].Content
|
||||
}
|
||||
urle := ExtractImageURL(res.Image)
|
||||
urlData := strings.Split(urle, " ")
|
||||
if len(urlData) == 1 {
|
||||
u, err := url.Parse(urle)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user