新同事欢迎你.txt

新同事欢迎你.txt
2011年03月07日
  这台电脑我使用了四个多月, 现在就要突然离开**了 , 有点不舍...
  你是第二个使用者.
  里面一些私有资料我进行了清理, 但可能还有一些文件没有处理到,望谅解.
  如果对你来说没有什么用,你完全可以格式化d,e, f盘默认有个xp文件夹是系统安装时的gost备份.(可以用来恢复系统).
  如果你还没重装系统的话,想接着使用的话,给你一点说明我对电脑的设置.
  1.桌面:
  桌面是我习惯的颜色,个工作方式 ,你可以 重新设置
  其中HelpFile文件夹,是java开发的一些chm 帮助文档.
  桌面日历和时钟是一个未注册软件,
  2,开发工具(基本安装在d盘)
  1)myeclipse 安装在 D:\MyEclopse 下,桌面有快捷方式
  2) jdk: D:\java 安装了1.4/5/6 ,环境变量path设置的是1.5的
  3) oracle客户端 : D:\oo ,当时随便取了名字,不太舒服.
  4) plsql ,... 快捷方式在桌面
  5) editPlus : D:\EditPlus 2\
  3 ,其它一些常用软件,都默认放在windows安装目录:C:\Program Files,
  所有都可以在开始菜单,和 桌面的 "here" ,文件夹.
  4. 浏览器
  IE 系统自带的ie6,
  Sougou浏览器 ,我个人习惯的浏览器
  firefox,google chrome, 我使用的绿色版,放在E:\greenSoftware\目录下.
  在快速启动栏 >>下,有快捷方式,
  最后祝你在**工作顺利 !!!
  bryant (qq:356984606) 2011-3-7 18:27
import os import re import requests import json from datetime import datetime # 增配置项 MEMORY_ROOT = "./memory" PERSONAL_DIR = os.path.join(MEMORY_ROOT, "personal") OTHERS_DIR = os.path.join(MEMORY_ROOT, "others") # 初始化存储目录 def init_memory_system(): os.makedirs(PERSONAL_DIR, exist_ok=True) os.makedirs(OTHERS_DIR, exist_ok=True) # 信息分类检测 def detect_info_type(text): personal_keywords = ['我', '我的', '自己'] others_keywords = ['他', '她', '他们', '朋友', '同事', '同学'] if any(keyword in text for keyword in personal_keywords): return "personal" elif any(keyword in text for keyword in others_keywords): return "others" return None # 实体提取 def extract_entity(text, info_type): if info_type == "personal": matches = re.findall(r'我的(\w+)[是|为](.*?)[,。]', text) if matches: return matches[0][0].strip(), matches[0][1].strip() elif info_type == "others": matches = re.findall(r'(朋友|同事|同学)(\w+)[的]?(\w+)[是|为](.*?)[,。]', text) if matches: return f"{matches[0][1]}_{matches[0][2]}", matches[0][3].strip() return None, None # 记忆存储 def save_to_memory(info_type, entity, content): try: target_dir = PERSONAL_DIR if info_type == "personal" else OTHERS_DIR filename = f"{entity}.txt" filepath = os.path.join(target_dir, filename) with open(filepath, "a") as f: timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") f.write(f"[{timestamp}] {content}\n") return True except Exception as e: print(f"存储失败:{e}") return False # 记忆检索 def search_memory(info_type, keywords): try: target_dir = PERSONAL_DIR if info_type == "personal" else OTHERS_DIR results = [] for filename in os.listdir(target_dir): if any(kw in filename for kw in keywords): filepath = os.path.join(target_dir, filename) with open(filepath, "r") as f: results.append(f.read()) return "\n".join(results) if results else None except Exception as e: print(f"检索失败:{e}") return None # 修改后的主函数 def main(): init_memory_system() print("欢迎使用增强版AI对话系统!输入'退出'结束对话。") while True: user_input = input("\n你:").strip() if user_input.lower() in ["退出", "exit"]: print("对话结束,再见!") break # 信息存储逻辑 info_type = detect_info_type(user_input) if info_type: entity, content = extract_entity(user_input, info_type) if entity and content: if save_to_memory(info_type, entity, content): print(f"[系统] 已存储{info_type}信息:{entity}") # 信息检索逻辑 required_info = detect_info_type(user_input) context = "" if required_info: keywords = re.findall(r'[\u4e00-\u9fa5]{2,}', user_input) memory_data = search_memory(required_info, keywords) if memory_data: context = f"\n[记忆库信息]\n{memory_data}\n" # 构造增强提示 enhanced_prompt = f"{format_conversation_history(conversation_history)}\n{context}\n请根据以上信息回答:{user_input}" # 发送请求 ai_response = send_request(enhanced_prompt) if ai_response: print(f"AI:{ai_response}") conversation_history.append(f"AI:{ai_response}") else: print("AI没有响应,请稍后再试。") 这段代码有问题
03-14
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值