Allow no knowledge

This commit is contained in:
Yang Luo 2023-09-08 00:50:50 +08:00
parent f0fa71f141
commit c65baeba0b
2 changed files with 5 additions and 1 deletions

View File

@ -173,7 +173,7 @@ func (c *ApiController) GetMessageAnswer() {
var stringBuilder strings.Builder
nearestText, err := object.GetNearestVectorText(authToken, chat.Owner, question)
if err != nil {
if err != nil && err.Error() != "no knowledge vectors found" {
c.ResponseErrorStream(err.Error())
return
}

View File

@ -17,6 +17,10 @@ package object
import "fmt"
func GetRefinedQuestion(knowledge string, question string) string {
if knowledge == "" {
return question
}
return fmt.Sprintf(`paragraph: %s
You are a reading comprehension expert. Please answer the following questions based on the provided content. The content may be in a different language from the questions, so you need to understand the content according to the language of the questions and ensure that your answers are translated into the same language as the questions: