translator

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MimeTypes = map[string]string{}/* 732 elements not displayed */

MimeTypes is a comprehensive map of file extensions to their corresponding MIME types. This is used to identify the type of file being uploaded or processed.

Functions

func ConvertCliToOpenAI

func ConvertCliToOpenAI(rawJson []byte, unixTimestamp int64, isGlAPIKey bool) string

ConvertCliToOpenAI translates a single chunk of a streaming response from the backend client format to the OpenAI Server-Sent Events (SSE) format. It returns an empty string if the chunk contains no useful data.

func ConvertCliToOpenAINonStream

func ConvertCliToOpenAINonStream(rawJson []byte, unixTimestamp int64, isGlAPIKey bool) string

ConvertCliToOpenAINonStream aggregates response from the backend client convert a single, non-streaming OpenAI-compatible JSON response.

func PrepareRequest

func PrepareRequest(rawJson []byte) (string, *client.Content, []client.Content, []client.ToolDeclaration)

PrepareRequest translates a raw JSON request from an OpenAI-compatible format to the internal format expected by the backend client. It parses messages, roles, content types (text, image, file), and tool calls.

Types

This section is empty.

Jump to

Keyboard shortcuts

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