'commit'
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,12 @@ from volcenginesdkarkruntime import Ark
|
|||||||
from Config.Config import VOLC_ACCESSKEY, VOLC_SECRETKEY, VOLC_API_KEY
|
from Config.Config import VOLC_ACCESSKEY, VOLC_SECRETKEY, VOLC_API_KEY
|
||||||
from VikingDBMemoryService import VikingDBMemoryService
|
from VikingDBMemoryService import VikingDBMemoryService
|
||||||
|
|
||||||
|
"""
|
||||||
|
在记忆库准备好后,我们先模拟一段包含两轮的完整对话。
|
||||||
|
对话结束后,把这段对话历史消息写入记忆库。然后再开启一个新话题,提出和刚才相关的问题,
|
||||||
|
AI 就能用刚写入的记忆来回答。
|
||||||
|
注意:首次写入需要 3–5 分钟建立索引,这段时间内检索会报错。
|
||||||
|
"""
|
||||||
def initialize_services():
|
def initialize_services():
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
ak = VOLC_ACCESSKEY
|
ak = VOLC_ACCESSKEY
|
||||||
@@ -170,8 +175,8 @@ def main():
|
|||||||
try:
|
try:
|
||||||
memory_service, llm_client = initialize_services()
|
memory_service, llm_client = initialize_services()
|
||||||
collection_name = "emotional_support"
|
collection_name = "emotional_support"
|
||||||
user_id = "xiaoming"
|
user_id = "xiaoming" # 用户ID:小明
|
||||||
assistant_id = "assistant"
|
assistant_id = "assistant1" # 助手ID:助手1
|
||||||
ensure_collection_exists(memory_service, collection_name)
|
ensure_collection_exists(memory_service, collection_name)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"初始化失败: {e}")
|
print(f"初始化失败: {e}")
|
||||||
|
Reference in New Issue
Block a user