break recurse generation if current output contains a delimiter using first OR last when combined with prev if not contains
parent
68a87dc3db
commit
287b72639d
|
|
@ -383,8 +383,8 @@ func chatBotGenerateAndFillInputF(ctx context.Context, cacheF, inputF, reversePr
|
|||
commands[1:]...,
|
||||
)
|
||||
command.Dir = Config.ChatBot.WD
|
||||
command.Stderr = io.Discard
|
||||
command.Stderr = log.Writer()
|
||||
command.Stderr = io.Discard
|
||||
|
||||
stdout, err := command.StdoutPipe()
|
||||
if err != nil {
|
||||
|
|
@ -412,11 +412,13 @@ func chatBotGenerateAndFillInputF(ctx context.Context, cacheF, inputF, reversePr
|
|||
return nil, err
|
||||
}
|
||||
justNew := oldAndNew[len(priorContent):]
|
||||
idx := bytes.LastIndex(
|
||||
|
||||
if idx := bytes.Index(justNew, []byte(reversePrompt)); idx > 0 {
|
||||
justNew = justNew[:idx]
|
||||
} else if idx := bytes.LastIndex(
|
||||
append(priorContent, justNew...),
|
||||
[]byte(reversePrompt),
|
||||
)
|
||||
if idx+len(reversePrompt) > len(priorContent) {
|
||||
); idx+len(reversePrompt) > len(priorContent) {
|
||||
justNew = justNew[:idx+len(reversePrompt)-len(priorContent)]
|
||||
}
|
||||
if err := _appendFile(inputF, string(justNew)); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue