mirror of
https://github.com/jie65535/JChatGPT.git
synced 2025-10-20 17:13:37 +08:00
Update memory structure
This commit is contained in:
@@ -15,9 +15,9 @@ object PluginData : AutoSavePluginData("data") {
|
|||||||
fun appendContactMemory(contactId: Long, newMemory: String) {
|
fun appendContactMemory(contactId: Long, newMemory: String) {
|
||||||
val memory = contactMemory[contactId]
|
val memory = contactMemory[contactId]
|
||||||
if (memory.isNullOrEmpty()) {
|
if (memory.isNullOrEmpty()) {
|
||||||
contactMemory[contactId] = "* $newMemory"
|
contactMemory[contactId] = newMemory
|
||||||
} else {
|
} else {
|
||||||
contactMemory[contactId] = "$memory\n* $newMemory"
|
contactMemory[contactId] = "$memory\n$newMemory"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ object PluginData : AutoSavePluginData("data") {
|
|||||||
fun replaceContactMemory(contactId: Long, oldMemory: String, newMemory: String) {
|
fun replaceContactMemory(contactId: Long, oldMemory: String, newMemory: String) {
|
||||||
val memory = contactMemory[contactId]
|
val memory = contactMemory[contactId]
|
||||||
if (memory.isNullOrEmpty()) {
|
if (memory.isNullOrEmpty()) {
|
||||||
contactMemory[contactId] = "* $newMemory"
|
contactMemory[contactId] = newMemory
|
||||||
} else {
|
} else {
|
||||||
contactMemory[contactId] = memory.replace(oldMemory, newMemory)
|
contactMemory[contactId] = memory.replace(oldMemory, newMemory)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user