Merge pull request #781 from trheyi/main

Remove unused utils import and clean up ImagesGenerations function
This commit is contained in:
Max 2024-11-08 08:18:46 +08:00 committed by GitHub
commit 0e5733cdd5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 12 deletions

View file

@ -10,7 +10,6 @@ import (
jsoniter "github.com/json-iterator/go"
"github.com/yaoapp/gou/process"
"github.com/yaoapp/kun/exception"
"github.com/yaoapp/kun/utils"
"github.com/yaoapp/yao/openai"
)
@ -42,16 +41,11 @@ func ImagesGenerations(process *process.Process) interface{} {
exception.New("ImagesGenerations error: %s", 400, err).Throw()
}
option["prompt"] = prompt
option["model"] = model
option["response_format"] = "url"
res, ex := ai.ImagesGenerations(prompt, option)
if ex != nil {
utils.Dump(ex)
ex.Throw()
}
return res
}

View file

@ -10,7 +10,6 @@ import (
"github.com/yaoapp/gou/connector"
"github.com/yaoapp/gou/http"
"github.com/yaoapp/kun/exception"
"github.com/yaoapp/kun/utils"
"github.com/yaoapp/yao/share"
)
@ -211,8 +210,6 @@ func (openai OpenAI) ImagesGenerations(prompt string, option map[string]interfac
}
option["prompt"] = prompt
utils.Dump(option)
return openai.postWithoutModel("/v1/images/generations", option)
}

View file

@ -106,16 +106,16 @@ func (dsl *DSL) translate(name string, process *gouProcess.Process, data interfa
}
widgets := []string{}
if dsl.Action.Bind.Model != "" {
if dsl.Action != nil && dsl.Action.Bind != nil && dsl.Action.Bind.Model != "" {
m := model.Select(dsl.Action.Bind.Model)
widgets = append(widgets, fmt.Sprintf("model.%s", m.ID))
}
if dsl.Action.Bind.Table != "" {
if dsl.Action != nil && dsl.Action.Bind != nil && dsl.Action.Bind.Table != "" {
widgets = append(widgets, fmt.Sprintf("table.%s", dsl.Action.Bind.Table))
}
if dsl.Action.Bind.Form != "" {
if dsl.Action != nil && dsl.Action.Bind != nil && dsl.Action.Bind.Form != "" {
widgets = append(widgets, fmt.Sprintf("form.%s", dsl.Action.Bind.Form))
}