Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复:老照片修复接口参数image_urls无法生效 #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chenhhA
Copy link

@chenhhA chenhhA commented Jul 22, 2024

接口参数BinaryDataBase64未设置omitempty, 导致该参数始终被序列化且为首选参数. image_urls 无法生效

复现代码

import (
	"encoding/json"
	"fmt"
	"github.com/volcengine/volc-sdk-golang/service/visual"
	"github.com/volcengine/volc-sdk-golang/service/visual/model"
)

func main() {
	testAk := "ak"
	testSk := "sk"

	visual.DefaultInstance.Client.SetAccessKey(testAk)
	visual.DefaultInstance.Client.SetSecretKey(testSk)
	//visual.DefaultInstance.SetRegion("region")
	//visual.DefaultInstance.SetHost("host")

	//请求入参
	reqBody := &model.ConvertPhotoV2Request{
		ReqKey:    "lens_opr", // 固定值
		ImageUrls: []string{"https://portal.volccdn.com/obj/volcfe/cloud-universal-doc/upload_242ef2ec0f7d750f3a1d1f172e0e5145.jpg"},
		IfColor:   1,
	}

	resp, status, err := visual.DefaultInstance.ConvertPhotoV2(reqBody)
	fmt.Println(status, err)
	b, _ := json.Marshal(resp)
	fmt.Println(string(b))
}

输出

{"request_id":"20240722154025BA796EA8128A6798F6FE","code":50207,"message":"Image Decode Error: image format unsupported: invalid binary_data_base64 type=\u003cnil\u003e","status":50207,"time_elapsed":"3.147165ms","data":null}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant