Documentation
¶
Index ¶
- Variables
- type ACPClientSideConnection
- type ChatUI
- func (ui *ChatUI) Init() tea.Cmd
- func (ui *ChatUI) RequestPermission(_ context.Context, params acp.RequestPermissionRequest) (acp.RequestPermissionResponse, error)
- func (ui *ChatUI) Run(ctx context.Context) error
- func (ui *ChatUI) SessionUpdate(_ context.Context, params acp.SessionNotification) error
- func (ui *ChatUI) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (ui *ChatUI) View() string
- type InputBox
- func (box *InputBox) Blur()
- func (box *InputBox) Focus() tea.Cmd
- func (box *InputBox) Focused() bool
- func (box *InputBox) MultiLineMode() bool
- func (box *InputBox) Reset()
- func (box *InputBox) Update(msg tea.Msg) (*InputBox, tea.Cmd)
- func (box *InputBox) Value() string
- func (box *InputBox) View() string
- type MessageItem
- type MessageType
- type MessageViewport
- type MessagesList
- type ModelSelector
- func (s *ModelSelector) GetSelectedModels() (ModelType, string, models.Models)
- func (s *ModelSelector) Init() tea.Cmd
- func (s *ModelSelector) SetAvailableModels(availableModels []models.ModelConfig)
- func (s *ModelSelector) SetContext(ctx context.Context)
- func (s *ModelSelector) SetCurrentModels(curModels models.Models)
- func (s *ModelSelector) SetModelType(t ModelType)
- func (s *ModelSelector) Update(msg tea.Msg) (*ModelSelector, tea.Cmd)
- func (s *ModelSelector) View() string
- type ModelType
- type Options
- type PromptResult
- type QuitError
- type Selector
- func (s Selector) Enabled() bool
- func (s *Selector) RenewTable()
- func (s Selector) Selected() string
- func (s *Selector) SetEnabled(enabled bool)
- func (s *Selector) SetSearchKey(key string)
- func (s *Selector) SetWidth(width int)
- func (s Selector) Update(msg tea.Msg) (Selector, tea.Cmd)
- func (s Selector) View() string
- type SelectorOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MsgNFANote = &i18n.Message{ ID: "ui.chat.NFANote", Other: "NOTE: Any output should not be construed as financial advice.", } MsgCmdDescClear = &i18n.Message{ ID: "ui.chat.CmdDescClear", Other: "Start a fresh conversation", } MsgCmdDescModel = &i18n.Message{ ID: "ui.chat.CmdDescModel", Other: "Set the AI model for NFA", } MsgCmdDescSkills = &i18n.Message{ ID: "ui.chat.CmdDescSkills", Other: "List loaded skills", } MsgCmdDescExit = &i18n.Message{ ID: "ui.chat.CmdDescExit", Other: "Exit the NFA", } MsgSkillsCount = &i18n.Message{ ID: "ui.chat.SkillsCount", One: "{{ .Count }} skill", Other: "{{ .Count }} skills", } MsgTokenUsage = &i18n.Message{ID: "ui.chat.TokenUsage", Other: "Token Usage:"} MsgSkills = &i18n.Message{ID: "ui.chat.Skills", Other: "Skills"} MsgBuiltinSkills = &i18n.Message{ID: "ui.chat.BuiltinSkills", Other: "Builtin skills"} MsgLocalSkills = &i18n.Message{ID: "ui.chat.LocalSkills", Other: "Local skills"} MsgSelectModel = &i18n.Message{ID: "ui.chat.SelectModel", Other: "Select {{ .Type }} model"} MsgMultilineMode = &i18n.Message{ID: "ui.chat.MultilineMode", Other: "MULTILINE MODE"} MsgTabToToggle = &i18n.Message{ID: "ui.chat.TabToToggle", Other: "(tab to toggle)"} MsgStopReason = &i18n.Message{ID: "ui.chat.StopReason", Other: "stop reason: {{ .Reason }}"} MsgToolCall = &i18n.Message{ID: "ui.chat.ToolCall", Other: "ToolCall:"} MsgSetModel = &i18n.Message{ID: "ui.chat.SetModel", Other: "set {{ .Type }} model:"} MsgResumeSession = &i18n.Message{ID: "ui.chat.ResumeSession", Other: "Resume this session with:"} MsgResumeCommand = &i18n.Message{ID: "ui.chat.ResumeCommand", Other: "nfa --resume {{ .SessionID }}"} )
Functions ¶
This section is empty.
Types ¶
type ACPClientSideConnection ¶
type ACPClientSideConnection interface {
Initialize(ctx context.Context, req acp.InitializeRequest) (acp.InitializeResponse, error)
NewSession(ctx context.Context, req acp.NewSessionRequest) (acp.NewSessionResponse, error)
LoadSession(ctx context.Context, req acp.LoadSessionRequest) (acp.LoadSessionResponse, error)
Prompt(ctx context.Context, req acp.PromptRequest) (acp.PromptResponse, error)
Cancel(ctx context.Context, req acp.CancelNotification) error
}
ACPClientSideConnection ACP 客户端侧连接
type ChatUI ¶
type ChatUI struct {
acputil.NopFS
acputil.NopTerminal
// contains filtered or unexported fields
}
ChatUI 对话 UI
func (*ChatUI) RequestPermission ¶
func (ui *ChatUI) RequestPermission( _ context.Context, params acp.RequestPermissionRequest, ) (acp.RequestPermissionResponse, error)
RequestPermission 请求授权
func (*ChatUI) SessionUpdate ¶
SessionUpdate 更新会话
type InputBox ¶
type InputBox struct {
// contains filtered or unexported fields
}
InputBox 输入框
func NewInputBox ¶
func NewInputBox(ctx context.Context, commands []SelectorOption, hist *history.History, histPath string) *InputBox
NewInputBox 创建输入框
func (*InputBox) MultiLineMode ¶
MultiLineMode 返回是否处于多行编辑模式
type MessageType ¶
type MessageType int
MessageType 消息类型
const ( MessageTypeUser MessageType = iota MessageTypeAgent MessageTypeAgentThought MessageTypeToolCall MessageTypeToolCallUpdate MessageTypeError MessageTypeUnknown )
type MessageViewport ¶
type MessageViewport struct {
// contains filtered or unexported fields
}
MessageViewport 消息视窗
func NewMessageViewport ¶
func NewMessageViewport(ctx context.Context) (MessageViewport, error)
NewMessageViewport 创建消息视窗
func (MessageViewport) AgentProcessing ¶
func (vp MessageViewport) AgentProcessing() bool
AgentProcessing 返回是否 Agent 处理中
func (MessageViewport) Update ¶
func (vp MessageViewport) Update(msg tea.Msg) (MessageViewport, tea.Cmd)
Update 处理更新事件
type MessagesList ¶
type MessagesList []MessageItem
MessagesList 消息列表
func (MessagesList) Append ¶
func (l MessagesList) Append(item MessageItem) MessagesList
Append 追加消息
type ModelSelector ¶
type ModelSelector struct {
// contains filtered or unexported fields
}
ModelSelector 模型选择器
func (*ModelSelector) GetSelectedModels ¶
func (s *ModelSelector) GetSelectedModels() (ModelType, string, models.Models)
GetSelectedModels 返回更新后的模型选择
func (*ModelSelector) SetAvailableModels ¶
func (s *ModelSelector) SetAvailableModels(availableModels []models.ModelConfig)
SetAvailableModels 设置可用模型列表
func (*ModelSelector) SetContext ¶
func (s *ModelSelector) SetContext(ctx context.Context)
SetContext 设置上下文
func (*ModelSelector) SetCurrentModels ¶
func (s *ModelSelector) SetCurrentModels(curModels models.Models)
SetCurrentModels 设置当前模型
func (*ModelSelector) SetModelType ¶
func (s *ModelSelector) SetModelType(t ModelType)
SetModelType 设置选择的模型类型
func (*ModelSelector) Update ¶
func (s *ModelSelector) Update(msg tea.Msg) (*ModelSelector, tea.Cmd)
Update 处理更新事件
type Options ¶
type Options struct {
AgentClientIn io.Reader
AgentClientOut io.Writer
InitialPrompt string
AutoExitAfterResponse bool
ResumeSessionID string
}
Options UI 运行选项
type PromptResult ¶
type PromptResult struct {
Response acp.PromptResponse
Error error
}
type Selector ¶
type Selector struct {
SuggestionPrefix string
ShowDescription bool
NamePadding int
// contains filtered or unexported fields
}
Selector 选择器
func NewSelector ¶
func NewSelector(items []SelectorOption, suggestionPrefix string, height, width int) Selector
NewSelector 创建选择器
type SelectorOption ¶
SelectorOption 选择器选项
Click to show internal directories.
Click to hide internal directories.