Browse Source

Warn user on truncation - ollama logs

ParthSareen 4 tháng trước cách đây
mục cha
commit
c9a46140e6
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      server/prompt.go

+ 4 - 0
server/prompt.go

@@ -82,6 +82,10 @@ func chatPrompt(ctx context.Context, m *Model, tokenize tokenizeFunc, opts *api.
 	}
 
 	currMsgIdx := n
+	// Warn user if messages are truncated from the input
+	if numTruncatedMessages := len(msgs[0:currMsgIdx]); numTruncatedMessages > 0 {
+		slog.Warn("truncated first messages from input", "num_truncated", numTruncatedMessages)
+	}
 
 	for cnt, msg := range msgs[currMsgIdx:] {
 		prefix := ""