fs: add trailing newlines to all static read/request handlers
POSIX compliance - text files should end with newlines. Fixed handlers: - requestComplete, requestGenerate, requestRoute - readSessionName, readSessionID - readAgentCost, readAgentSystemprompt, readAgentName, readAgentID
This commit is contained in:
parent
0f29757dac
commit
853117758c
|
|
@ -131,7 +131,7 @@ func requestComplete(_ HandlerCtx, data []byte) ([]byte, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []byte(result), nil
|
||||
return []byte(result + "\n"), nil
|
||||
}
|
||||
|
||||
func requestGenerate(_ HandlerCtx, data []byte) ([]byte, error) {
|
||||
|
|
@ -143,7 +143,7 @@ func requestGenerate(_ HandlerCtx, data []byte) ([]byte, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []byte(result), nil
|
||||
return []byte(result + "\n"), nil
|
||||
}
|
||||
|
||||
func requestRoute(_ HandlerCtx, data []byte) ([]byte, error) {
|
||||
|
|
@ -155,7 +155,7 @@ func requestRoute(_ HandlerCtx, data []byte) ([]byte, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []byte(fmt.Sprintf("backend=%s model=%s", result.Backend, result.Model)), nil
|
||||
return []byte(fmt.Sprintf("backend=%s model=%s\n", result.Backend, result.Model)), nil
|
||||
}
|
||||
|
||||
func readAliases(_ HandlerCtx) ([]byte, error) {
|
||||
|
|
@ -361,7 +361,7 @@ func writeSessionCtl(ctx HandlerCtx, data []byte) error {
|
|||
}
|
||||
|
||||
func readSessionName(ctx HandlerCtx) ([]byte, error) {
|
||||
return []byte(ctx.Session.Name()), nil
|
||||
return []byte(ctx.Session.Name() + "\n"), nil
|
||||
}
|
||||
|
||||
func writeSessionName(ctx HandlerCtx, data []byte) error {
|
||||
|
|
@ -377,7 +377,7 @@ func writeSessionName(ctx HandlerCtx, data []byte) error {
|
|||
}
|
||||
|
||||
func readSessionID(ctx HandlerCtx) ([]byte, error) {
|
||||
return []byte(ctx.Session.ID()), nil
|
||||
return []byte(ctx.Session.ID() + "\n"), nil
|
||||
}
|
||||
|
||||
func readSessionElevate(ctx HandlerCtx) ([]byte, error) {
|
||||
|
|
@ -680,7 +680,7 @@ func readAgentUsage(ctx HandlerCtx) ([]byte, error) {
|
|||
}
|
||||
|
||||
func readAgentCost(ctx HandlerCtx) ([]byte, error) {
|
||||
return []byte(ctx.Agent.CostStr()), nil
|
||||
return []byte(ctx.Agent.CostStr() + "\n"), nil
|
||||
}
|
||||
|
||||
func readAgentCtxsz(ctx HandlerCtx) ([]byte, error) {
|
||||
|
|
@ -692,7 +692,7 @@ func readAgentModels(ctx HandlerCtx) ([]byte, error) {
|
|||
}
|
||||
|
||||
func readAgentSystemprompt(ctx HandlerCtx) ([]byte, error) {
|
||||
return []byte(ctx.Agent.SystemPrompt()), nil
|
||||
return []byte(ctx.Agent.SystemPrompt() + "\n"), nil
|
||||
}
|
||||
|
||||
func readAgentContext(ctx HandlerCtx) ([]byte, error) {
|
||||
|
|
@ -733,7 +733,7 @@ func writeAgentTools(ctx HandlerCtx, data []byte) error {
|
|||
}
|
||||
|
||||
func readAgentName(ctx HandlerCtx) ([]byte, error) {
|
||||
return []byte(ctx.Agent.Name()), nil
|
||||
return []byte(ctx.Agent.Name() + "\n"), nil
|
||||
}
|
||||
|
||||
func writeAgentName(ctx HandlerCtx, data []byte) error {
|
||||
|
|
@ -747,7 +747,7 @@ func writeAgentName(ctx HandlerCtx, data []byte) error {
|
|||
}
|
||||
|
||||
func readAgentID(ctx HandlerCtx) ([]byte, error) {
|
||||
return []byte(ctx.Agent.ID()), nil
|
||||
return []byte(ctx.Agent.ID() + "\n"), nil
|
||||
}
|
||||
|
||||
func streamChat(al *AgentLog, cctx context.Context, base string) ([]byte, string, error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue