mirror of https://github.com/Mai-with-u/MaiBot.git
parent
4fb0fec17c
commit
db48a1830a
|
|
@ -44,12 +44,4 @@ class LLMModel:
|
||||||
return "没有返回结果", "" # 返回两个值
|
return "没有返回结果", "" # 返回两个值
|
||||||
|
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
return f"请求失败: {str(e)}", "" # 返回错误信息和空字符串
|
return f"请求失败: {str(e)}", "" # 返回错误信息和空字符串
|
||||||
|
|
||||||
# 示例用法
|
|
||||||
if __name__ == "__main__":
|
|
||||||
model = LLMModel() # 默认使用 DeepSeek-V3 模型
|
|
||||||
prompt = "你好,你喜欢我吗?"
|
|
||||||
result, reasoning = model.generate_response(prompt)
|
|
||||||
print("回复内容:", result)
|
|
||||||
print("推理内容:", reasoning)
|
|
||||||
|
|
@ -91,22 +91,6 @@ class Memory_graph:
|
||||||
chat_text += f'[{time_str}] {record["user_nickname"] or "用户" + str(record["user_id"])}: {record["processed_plain_text"]}\n' # 添加发送者和时间信息
|
chat_text += f'[{time_str}] {record["user_nickname"] or "用户" + str(record["user_id"])}: {record["processed_plain_text"]}\n' # 添加发送者和时间信息
|
||||||
return chat_text
|
return chat_text
|
||||||
|
|
||||||
# all_record = list(self.db.db.messages.aggregate([
|
|
||||||
# {"$match": {"time": {"$exists": True}}}, # 只选择有时间戳的记录
|
|
||||||
# {"$group": {"_id": "$group_id", "records": {"$push": "$$ROOT"}}},
|
|
||||||
# {"$unwind": "$records"},
|
|
||||||
# {"$sort": {"records.time": 1}}
|
|
||||||
# ]))
|
|
||||||
# for record in all_record:
|
|
||||||
# if 'time' in record:
|
|
||||||
# time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(record['time'])));
|
|
||||||
# else:
|
|
||||||
# print(f"记录中缺少'time'键: {record}")
|
|
||||||
# continue # 跳过没有时间的记录
|
|
||||||
# chat_text.append(f'[{time_str}] {record["user_nickname"] or "用户" + str(record["user_id"])}: {record["processed_plain_text"]}') # 添加发送者和时间信息
|
|
||||||
# return chat_text
|
|
||||||
|
|
||||||
|
|
||||||
return [] # 如果没有找到记录,返回空列表
|
return [] # 如果没有找到记录,返回空列表
|
||||||
|
|
||||||
def save_graph_to_db(self):
|
def save_graph_to_db(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue