4 3 weeks ago

The first version of KiwiMate that has decent intelligence

vision
770bc9f11c44 · 399B
{{- if .System -}}
system
{{ .System }}
{{- end -}}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}
user
{{ .Content }}
{{- else if eq .Role "assistant" }}
assistant
{{ if .Content }}{{ .Content }}{{ if not $last }}
{{- else -}}{{- end -}}
{{- end -}}
{{- end -}}
{{- if and (ne .Role "assistant") $last }}
assistant
{{ end -}}
{{- end }}