utils

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyToString

func BodyToString(header http.Header, body []byte) string

func CheckServiceIsExistInEnv

func CheckServiceIsExistInEnv(serviceName string) bool

CheckServiceIsExistInEnv 检查服务是否存在于环境变量

func Contains

func Contains(slice []string, target string) bool

func DownloadFile

func DownloadFile(downloadURL string, saveDir string) (string, error)

func GenerateNonceString

func GenerateNonceString(n int) string

func GetAOGDataDir

func GetAOGDataDir() (string, error)

func GetAbsolutePath

func GetAbsolutePath(p string, base string) string

GetAbsolutePath Convert relative path to absolute path from the passed in base directory No change if the passed in path is already an absolute path

func GetDownloadDir

func GetDownloadDir() (string, error)

func GetGpuInfo

func GetGpuInfo() (int, error)

func GetSystemVersion

func GetSystemVersion() int

func GetUserDataDir

func GetUserDataDir() (string, error)

func HmacSha256

func HmacSha256(s, key string) string

func HmacSha256String

func HmacSha256String(s, key string) string

func IpexOllamaSupportGPUStatus

func IpexOllamaSupportGPUStatus() bool

func IsHTTPText

func IsHTTPText(header http.Header) bool

func IsServerRunning

func IsServerRunning() bool

func ParseImageData

func ParseImageData(data []byte) ([][]byte, error)

func ParseTableOutput

func ParseTableOutput(output string) map[string]string

+-----------------------------+--------------------------------------------------------------------+ | Device ID | 0 | +-----------------------------+--------------------------------------------------------------------+ | GPU Utilization (%) | 0 | | EU Array Active (%) | | Analyze the output table content of the above terminal command

func Sha256hex

func Sha256hex(s string) string

func StartAOGServer

func StartAOGServer(logPath string, pidFilePath string) error

func StopAOGServer

func StopAOGServer(pidFilePath string) error

func UnzipFile

func UnzipFile(zipFile, destDir string) error

解压文件 区分系统 win/linux/macos

Types

type MemoryInfo

type MemoryInfo struct {
	Size       int
	MemoryType string
}

func GetMemoryInfo

func GetMemoryInfo() (*MemoryInfo, error)

type SafeList

type SafeList struct {
	// contains filtered or unexported fields
}

func NewSafeList

func NewSafeList() *SafeList

func (*SafeList) Back

func (sl *SafeList) Back() *list.Element

func (*SafeList) Front

func (sl *SafeList) Front() *list.Element

func (*SafeList) InsertAfter

func (sl *SafeList) InsertAfter(v any, mark *list.Element) *list.Element

func (*SafeList) InsertBefore

func (sl *SafeList) InsertBefore(v any, mark *list.Element) *list.Element

func (*SafeList) Len

func (l *SafeList) Len() int

func (*SafeList) MoveAfter

func (sl *SafeList) MoveAfter(e, mark *list.Element)

func (*SafeList) MoveBefore

func (sl *SafeList) MoveBefore(e, mark *list.Element)

func (*SafeList) MoveToBack

func (sl *SafeList) MoveToBack(e *list.Element)

func (*SafeList) MoveToFront

func (sl *SafeList) MoveToFront(e *list.Element)

func (*SafeList) PushBack

func (sl *SafeList) PushBack(v any) *list.Element

func (*SafeList) PushFront

func (sl *SafeList) PushFront(v any) *list.Element

func (*SafeList) Remove

func (sl *SafeList) Remove(e *list.Element) any

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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