refactorings
This commit is contained in:
@@ -299,16 +299,20 @@ func (a *Agent) knowledgeBaseLookup() {
|
|||||||
}
|
}
|
||||||
xlog.Info("[Knowledge Base Lookup] Last user message", "agent", a.Character.Name, "message", userMessage)
|
xlog.Info("[Knowledge Base Lookup] Last user message", "agent", a.Character.Name, "message", userMessage)
|
||||||
|
|
||||||
if userMessage != "" {
|
if userMessage == "" {
|
||||||
|
xlog.Info("[Knowledge Base Lookup] No user message found in conversation", "agent", a.Character.Name)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
results, err := a.options.ragdb.Search(userMessage, a.options.kbResults)
|
results, err := a.options.ragdb.Search(userMessage, a.options.kbResults)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
xlog.Info("Error finding similar strings inside KB:", "error", err)
|
xlog.Info("Error finding similar strings inside KB:", "error", err)
|
||||||
|
|
||||||
// job.Result.Finish(fmt.Errorf("error finding similar strings inside KB: %w", err))
|
|
||||||
// return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(results) != 0 {
|
if len(results) == 0 {
|
||||||
|
xlog.Info("[Knowledge Base Lookup] No similar strings found in KB", "agent", a.Character.Name)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
formatResults := ""
|
formatResults := ""
|
||||||
for _, r := range results {
|
for _, r := range results {
|
||||||
@@ -328,8 +332,6 @@ func (a *Agent) knowledgeBaseLookup() {
|
|||||||
Content: fmt.Sprintf("Given the user input you have the following in memory:\n%s", formatResults),
|
Content: fmt.Sprintf("Given the user input you have the following in memory:\n%s", formatResults),
|
||||||
}}, a.currentConversation...)
|
}}, a.currentConversation...)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *Agent) consumeJob(job *Job, role string) {
|
func (a *Agent) consumeJob(job *Job, role string) {
|
||||||
a.Lock()
|
a.Lock()
|
||||||
|
|||||||
Reference in New Issue
Block a user