Files
LocalAI/core/services/studio/contextfiles/doc.go
T
Ettore Di Giacinto b64b35b5a4 feat(studio): add a generic loader for context files
A source declares a scope (user, agent or channel), a home-relative index
path and a byte cap. The loader reads the indexes that apply to a chat and
returns one bounded block under a fixed header, plus a key that changes with
it. Details of a topic are read next to the index; the path is built from
the registry and the chat, so the model can only name a topic.

The package only reads. A Writer interface lets a later change plug in the
save path, and CheckIndex and CheckProfile return the current entries when a
write would pass a cap, so the model merges them.

Assisted-by: Claude Code:claude-sonnet-5-5
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-11-03 09:28:57 +00:00

17 lines
896 B
Go

// Package contextfiles loads small files of the user's home into the prompt of
// a chat, and reads their details on demand.
//
// It is the host side of a generic mechanism. Any component registers a
// Source: a scope (user, agent or channel), a home-relative path to a short
// index file and a byte cap. Each turn the Loader reads the index of every
// source that applies to the chat and returns one block, under a fixed header
// that tells the model to consult the notes. The details of a topic stay in
// files next to the index and are read with the memory_read tool. Nothing in
// this package knows which application started the chat: a plain Studio chat,
// a chat that came from a messaging app and a chat of a saved agent all use
// the same code.
//
// The package only reads. The path that saves a note is a Writer that another
// part of the host plugs in.
package contextfiles