diff --git a/config/config.toml b/config/config.toml index b617a5aca..7f08132d5 100644 --- a/config/config.toml +++ b/config/config.toml @@ -158,11 +158,31 @@ filter = "(now() - item.Timestamp).Hours() < 168" # # embedding: recommend by Euclidean distance of embeddings. # # tags: recommend by number of common tags. # # users: recommend by number of common users. +# # chat: recommend by chat completion model. # type = "embedding" # # The column of the item embeddings. Leave blank if type is "users". # column = "item.Labels.embedding" +# [[recommend.item-to-item]] + +# # The name of the item-to-item recommender. +# name = "chat_recommend" + +# # The type of the item-to-item recommender. +# type = "chat" + +# # The column of the item embeddings. Leave blank if type is "users". +# column = "item.Labels.embedding" + +# # The prompt for the chat completion model. +# prompt = """ +# This is the description of GitHub repository https://github.com/{{ item.ItemId | replace(':','/') }}: +# {{ item.Comment }} +# Please find some similar repositores on GitHub and provide a brief description for each of them. +# The output should be a JSON array. +# """ + [recommend.user_neighbors] # The type of neighbors for users. There are three types: diff --git a/logics/item_to_item.go b/logics/item_to_item.go index e69d95e3e..01065d82b 100644 --- a/logics/item_to_item.go +++ b/logics/item_to_item.go @@ -430,6 +430,8 @@ func (g *chatItemToItem) PopAll(i int) []cache.Score { return nil } messages := parseMessage(resp.Choices[0].Message.Content) + log.Logger().Debug("chat based item-to-item recommendation", + zap.String("prompt", buf.String()), zap.Strings("response", messages)) // message embedding embeddings := make([][]float32, len(messages)) for i, message := range messages { diff --git a/storage/cache/database.go b/storage/cache/database.go index b10df44d3..00dbece81 100644 --- a/storage/cache/database.go +++ b/storage/cache/database.go @@ -72,10 +72,6 @@ const ( UserToUserUpdateTime = "user-to-user_update_time" Neighbors = "neighbors" - Chat = "chat" - ChatDigest = "chat_digest" - ChatUpdateTime = "chat_update_time" - // ItemCategories is the set of item categories. The format of key: // Global item categories - item_categories ItemCategories = "item_categories"