Documentation
¶
Overview ¶
Package ndjson provides types for handling NDJSON (Newline Delimited JSON) format. Which is returned from the docs.github.com AI Search API when streaming responses.
Index ¶
- Constants
- Variables
- func AutoLink(url, text string) string
- func EscapeMarkdown(s string) string
- func ExitCouldNotAnswer()
- func Fatal(err error)
- func IsLight() bool
- func IsVersionSupported(version string) bool
- func NewAutoRenderer(wrap int) *glamour.TermRenderer
- func NewRenderer(theme string, wrap int) *glamour.TermRenderer
- func NormalizeVersion(v string) string
- func RenderFrame(r *glamour.TermRenderer, raw string, spin rune, prevLines *int)
- func RenderSpinner(spin rune)
- func StripANSI(s string) string
- type GenericLine
- type Source
- type SupportedVersions
Constants ¶
const ( ChunkConversationID = "CONVERSATION_ID" ChunkNoContent = "NO_CONTENT_SIGNAL" ChunkSources = "SOURCES" ChunkMessage = "MESSAGE_CHUNK" ChunkInputFilter = "INPUT_CONTENT_FILTER" )
NDJSON discriminator keys
Variables ¶
var SpinnerFrames = []rune{'|', '/', '-', '\\'}
Functions ¶
func EscapeMarkdown ¶
func ExitCouldNotAnswer ¶
func ExitCouldNotAnswer()
func IsVersionSupported ¶
IsVersionSupported checks if a given enterprise server version is supported
func NewAutoRenderer ¶ added in v1.0.2
func NewAutoRenderer(wrap int) *glamour.TermRenderer
NewAutoRenderer returns a Glamour renderer that automatically detects the best theme
func NewRenderer ¶
func NewRenderer(theme string, wrap int) *glamour.TermRenderer
newRenderer returns a Glamour renderer with the provided theme and wrap width.
func NormalizeVersion ¶
func RenderFrame ¶
func RenderFrame(r *glamour.TermRenderer, raw string, spin rune, prevLines *int)
renderFrame renders the buffer plus a spinner, clearing the previous frame first.
func RenderSpinner ¶
func RenderSpinner(spin rune)
renderSpinner prints a single rune to stderr, keeping stdout clean.
Types ¶
type GenericLine ¶
type GenericLine struct { ChunkType string `json:"chunkType"` Text string `json:"text,omitempty"` Sources json.RawMessage `json:"sources,omitempty"` ConversationID string `json:"conversation_id,omitempty"` }
type SupportedVersions ¶
type SupportedVersions struct { LastUpdated string `json:"lastUpdated"` SupportedVersions []string `json:"supportedVersions"` LatestVersion string `json:"latestVersion"` }
SupportedVersions represents the structure of the supported versions JSON file
func LoadSupportedVersions ¶
func LoadSupportedVersions() (*SupportedVersions, error)
LoadSupportedVersions loads the supported enterprise versions from the JSON file