Merge pull request #781 from trheyi/main
Remove unused utils import and clean up ImagesGenerations function
This commit is contained in:
commit
0e5733cdd5
3 changed files with 3 additions and 12 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue