apihelper

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package apihelper provides a small set of shared HTTP helpers reused by the scheduler LLM time-parser, the RAG ask path, and the RAG extractor. It centralizes the base-URL override, a shared proxy-aware HTTP client, and a response-truncation utility so these callers do not duplicate the HTTP boilerplate.

(The former private-protocol APICall helper was removed in WP-2.6 along with the multimodal tools; only the generic Client/BaseURL/Truncate utilities remain, borrowed by the /chat/completions callers above.)

Index

Constants

This section is empty.

Variables

View Source
var BaseURL = defaultBaseURL

BaseURL is the API root for direct /chat/completions calls made by the scheduler time-parser and RAG ask. It's a var (not a const) so a private deployment or proxy can override it at boot via SetBaseDomain.

View Source
var Client = &http.Client{Timeout: 120 * time.Second}

Client is a shared HTTP client for the direct /chat/completions callers.

Functions

func SetBaseDomain

func SetBaseDomain(base string)

SetBaseDomain overrides the API base URL used by the direct /chat/completions callers. Pass the full base (e.g. "https://api.example.com/v1"); an empty value resets to the default. boot.go derives the value from [cowork] fast_llm_base_domain so a private deployment or proxy can redirect these calls without code changes.

func SetClient

func SetClient(c *http.Client)

SetClient replaces the shared HTTP client. boot.go calls this so direct /chat/completions calls go through the same configured client (proxy, timeouts) as the rest of the app; without it callers use the default 120s client and may fail with EOF in proxy-only environments.

func Truncate

func Truncate(s string, n int) string

Truncate shortens s to n bytes, snapping to the last space to avoid cutting mid-word. Returns s unchanged if it's already short enough.

Types

This section is empty.

Jump to

Keyboard shortcuts

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