This commit is contained in:
Michael Yang 2024-04-24 16:12:56 -07:00
parent 238715037d
commit abe614c705
2 changed files with 118 additions and 58 deletions

View file

@ -26,7 +26,10 @@ const (
stateComment
)
var errInvalidRole = errors.New("role must be one of \"system\", \"user\", or \"assistant\"")
var (
errMissingFrom = errors.New("no FROM line")
errInvalidRole = errors.New("role must be one of \"system\", \"user\", or \"assistant\"")
)
func Parse(r io.Reader) (cmds []Command, err error) {
var cmd Command
@ -123,7 +126,7 @@ func Parse(r io.Reader) (cmds []Command, err error) {
}
}
return nil, errors.New("no FROM line")
return nil, errMissingFrom
}
func parseRuneForState(r rune, cs state) (state, rune, error) {