graph

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 ExtractImageSizeOpenAI(g workflow.Graph, supported ...string) string

func ExtractNegativePrompt

func ExtractNegativePrompt(g workflow.Graph) (string, bool)

ExtractNegativePrompt 优先从 NegativePrompt 节点读取,再回退全图 stringOption。

func ExtractPrompt

func ExtractPrompt(g workflow.Graph) (string, error)

func ExtractSpeechResponseFormat

func ExtractSpeechResponseFormat(g workflow.Graph) string

func ExtractSpeechSpeed

func ExtractSpeechSpeed(g workflow.Graph) (float64, bool)

func ExtractSpeechVoice

func ExtractSpeechVoice(g workflow.Graph) (string, bool)

func ExtractVideoDimensions

func ExtractVideoDimensions(g workflow.Graph, supported ...string) (width, height int, ok bool)

func ExtractVideoDuration

func ExtractVideoDuration(g workflow.Graph) (float64, bool)

ExtractVideoDuration 优先 VideoOptions.duration,再回退全图。

func FirstImageURL

func FirstImageURL(g workflow.Graph) (string, bool)

FirstImageURL 返回首张参考图 URL(图生视频等)。

func Float64Option

func Float64Option(g workflow.Graph, keys ...string) (float64, bool)

func Float64OptionFromClassTypes

func Float64OptionFromClassTypes(g workflow.Graph, classTypes []string, keys ...string) (float64, bool)

Float64OptionFromClassTypes 仅在指定 class_type 的节点上查找 keys(支持 int/float64/数字字符串)。

func ImageBytesForEdits

func ImageBytesForEdits(g workflow.Graph, client *http.Client, allowRemoteURL bool) ([]byte, error)

ImageBytesForEdits 为 OpenAI images/edits 准备 PNG 字节(url / base64 / 本地路径)。 allowRemoteURL 为 false 时,image_url / edit_image_url 不会发起 HTTP 请求(降低 SSRF 风险)。

func IntOption

func IntOption(g workflow.Graph, keys ...string) (int, bool)

func IntOptionFromClassTypes

func IntOptionFromClassTypes(g workflow.Graph, classTypes []string, keys ...string) (int, bool)

IntOptionFromClassTypes 仅在指定 class_type 的节点上查找整型 keys。

func IntOptionPreferVideoOptions

func IntOptionPreferVideoOptions(g workflow.Graph, keys ...string) (int, bool)

IntOptionPreferVideoOptions 先查 VideoOptions 节点,再全图 IntOption。

func MergeJSONObject

func MergeJSONObject(g workflow.Graph, dst map[string]any, inputKeys ...string) error

MergeJSONObject 将图中 JSON 对象字符串合并进 dst(浅合并,嵌套不递归)。

func RawJSONBody

func RawJSONBody(g workflow.Graph) ([]byte, bool)

RawJSONBody 若图中存在 request_body / generate_content_body 等整段 JSON,则返回其字节。

func StringOption

func StringOption(g workflow.Graph, keys ...string) (string, bool)

func StringOptionFromClassTypes

func StringOptionFromClassTypes(g workflow.Graph, classTypes []string, keys ...string) (string, bool)

StringOptionFromClassTypes 仅在指定 class_type 的节点上查找 keys(顺序:图中节点 id 序)。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL