askdocs

package
v1.1.1 Latest Latest
Warning

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

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

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

View Source
const (
	ChunkConversationID = "CONVERSATION_ID"
	ChunkNoContent      = "NO_CONTENT_SIGNAL"
	ChunkSources        = "SOURCES"
	ChunkMessage        = "MESSAGE_CHUNK"
	ChunkInputFilter    = "INPUT_CONTENT_FILTER"
)

NDJSON discriminator keys

Variables

View Source
var SpinnerFrames = []rune{'|', '/', '-', '\\'}

Functions

func AutoLink(url, text string) string

func EscapeMarkdown

func EscapeMarkdown(s string) string

func ExitCouldNotAnswer

func ExitCouldNotAnswer()

func Fatal

func Fatal(err error)

func IsLight

func IsLight() bool

func IsVersionSupported

func IsVersionSupported(version string) bool

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 NormalizeVersion(v string) string

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.

func StripANSI

func StripANSI(s string) string

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 Source

type Source struct {
	Title string `json:"title"`
	URL   string `json:"url"`
}

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

Jump to

Keyboard shortcuts

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