fix
This commit is contained in:
@@ -140,10 +140,19 @@ func (s *server) handleChatCompletions(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
system, user := splitMessages(req.Messages)
|
||||
comp, err := processing.HeuristicCompleter{}.Complete(context.Background(), system, user)
|
||||
if err != nil {
|
||||
http.Error(w, `{"error":{"message":"completer failed"}}`, http.StatusInternalServerError)
|
||||
return
|
||||
var comp processing.Completion
|
||||
// A category formula in the prompt is answered in that formula's shape, so a
|
||||
// local run proves the formula reached the model and the reply passes the
|
||||
// pipeline's formula gate. Everything else keeps the heuristic fallback.
|
||||
if text, ok := buildFormulaReply(system, user); ok {
|
||||
comp = processing.Completion{Text: text}
|
||||
} else {
|
||||
var err error
|
||||
comp, err = processing.HeuristicCompleter{}.Complete(context.Background(), system, user)
|
||||
if err != nil {
|
||||
http.Error(w, `{"error":{"message":"completer failed"}}`, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
model := strings.TrimSpace(req.Model)
|
||||
if model == "" {
|
||||
|
||||
Reference in New Issue
Block a user