Documentation
¶
Index ¶
- Variables
- func AudioBytesForWhisper(g workflow.Graph, client *http.Client, allowRemoteURL bool) (filename string, data []byte, err error)
- func ExtractImageSizeOpenAI(g workflow.Graph, supported ...string) string
- func ExtractNegativePrompt(g workflow.Graph) (string, bool)
- func ExtractPrompt(g workflow.Graph) (string, error)
- func ExtractSpeechResponseFormat(g workflow.Graph) string
- func ExtractSpeechSpeed(g workflow.Graph) (float64, bool)
- func ExtractSpeechVoice(g workflow.Graph) (string, bool)
- func ExtractVideoDimensions(g workflow.Graph, supported ...string) (width, height int, ok bool)
- func ExtractVideoDuration(g workflow.Graph) (float64, bool)
- func FirstImageURL(g workflow.Graph) (string, bool)
- func Float64Option(g workflow.Graph, keys ...string) (float64, bool)
- func Float64OptionFromClassTypes(g workflow.Graph, classTypes []string, keys ...string) (float64, bool)
- func ImageBytesForEdits(g workflow.Graph, client *http.Client, allowRemoteURL bool) ([]byte, error)
- func IntOption(g workflow.Graph, keys ...string) (int, bool)
- func IntOptionFromClassTypes(g workflow.Graph, classTypes []string, keys ...string) (int, bool)
- func IntOptionPreferVideoOptions(g workflow.Graph, keys ...string) (int, bool)
- func MergeJSONObject(g workflow.Graph, dst map[string]any, inputKeys ...string) error
- func RawJSONBody(g workflow.Graph) ([]byte, bool)
- func StringOption(g workflow.Graph, keys ...string) (string, bool)
- func StringOptionFromClassTypes(g workflow.Graph, classTypes []string, keys ...string) (string, bool)
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingPrompt = errors.New("graph: prompt not found in workflow graph") ErrMissingImageSource = errors.New("graph: image source for edits not found (image_url, image_b64, image_path, LoadImage)") ErrMissingAudioSource = errors.New("graph: audio source for whisper not found (audio_url, audio_path, audio_b64)") // ErrRemoteMediaDisabled 表示已关闭远程 URL 拉取,但图中仍使用 image_url/audio_url。 ErrRemoteMediaDisabled = errors.New("graph: remote media URL fetch disabled") )
Functions ¶
func AudioBytesForWhisper ¶
func AudioBytesForWhisper(g workflow.Graph, client *http.Client, allowRemoteURL bool) (filename string, data []byte, err error)
AudioBytesForWhisper 为 Whisper multipart 准备音频字节与文件名。
func ExtractImageSizeOpenAI ¶
func ExtractNegativePrompt ¶
ExtractNegativePrompt 优先从 NegativePrompt 节点读取,再回退全图 stringOption。
func ExtractVideoDimensions ¶
func ExtractVideoDuration ¶
ExtractVideoDuration 优先 VideoOptions.duration,再回退全图。
func FirstImageURL ¶
FirstImageURL 返回首张参考图 URL(图生视频等)。
func Float64OptionFromClassTypes ¶
func Float64OptionFromClassTypes(g workflow.Graph, classTypes []string, keys ...string) (float64, bool)
Float64OptionFromClassTypes 仅在指定 class_type 的节点上查找 keys(支持 int/float64/数字字符串)。
func ImageBytesForEdits ¶
ImageBytesForEdits 为 OpenAI images/edits 准备 PNG 字节(url / base64 / 本地路径)。 allowRemoteURL 为 false 时,image_url / edit_image_url 不会发起 HTTP 请求(降低 SSRF 风险)。
func IntOptionFromClassTypes ¶
IntOptionFromClassTypes 仅在指定 class_type 的节点上查找整型 keys。
func IntOptionPreferVideoOptions ¶
IntOptionPreferVideoOptions 先查 VideoOptions 节点,再全图 IntOption。
func MergeJSONObject ¶
MergeJSONObject 将图中 JSON 对象字符串合并进 dst(浅合并,嵌套不递归)。
func RawJSONBody ¶
RawJSONBody 若图中存在 request_body / generate_content_body 等整段 JSON,则返回其字节。
Types ¶
This section is empty.