Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
comments
Michael Yang4d083635803f
diff --git a/parser/parser.go b/parser/parser.goindex a42c0275e..c6667d668 100644--- a/parser/parser.go+++ b/parser/parser.go@@ -53,22 +53,26 @@ func Parse(r io.Reader) (cmds []Command, err error) {return nil, err}+ // process the state transition, some transitions need to be intercepted and redirectedif next != curr {switch curr {case stateName, stateParameter:+ // next state sometimes depends on the current buffer valueswitch s := strings.ToLower(b.String()); s {case "from":cmd.Name = "model"case "parameter":+ // transition to stateParameter which sets command namenext = stateParametercase "message":+ // transition to stateMessage which validates the message rolenext = stateMessagefallthroughdefault:cmd.Name = s}case stateMessage:- if !isValidRole(b.String()) {+ if !isValidMessageRole(b.String()) {return nil, errInvalidRole}@@ -234,6 +238,6 @@ func isNewline(r rune) bool {return r == '\r' || r == '\n'}-func isValidRole(role string) bool {+func isValidMessageRole(role string) bool {return role == "system" || role == "user" || role == "assistant"}