aetherforge-platform 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. aetherforge_platform-1.0.0.dist-info/METADATA +86 -0
  2. aetherforge_platform-1.0.0.dist-info/RECORD +55 -0
  3. aetherforge_platform-1.0.0.dist-info/WHEEL +5 -0
  4. aetherforge_platform-1.0.0.dist-info/top_level.txt +4 -0
  5. ai-life-assistant-copy/ai_agent.py +145 -0
  6. ai-life-assistant-copy/avatar_manager.py +231 -0
  7. ai-life-assistant-copy/avatar_packer.py +261 -0
  8. ai-life-assistant-copy/backup_all.py +262 -0
  9. ai-life-assistant-copy/backups/backup_20260404_193836/ai_agent.py +145 -0
  10. ai-life-assistant-copy/backups/backup_20260404_193836/avatar_manager.py +231 -0
  11. ai-life-assistant-copy/backups/backup_20260404_193836/avatar_packer.py +261 -0
  12. ai-life-assistant-copy/backups/backup_20260404_193836/backup_all.py +262 -0
  13. ai-life-assistant-copy/backups/backup_20260404_193836/commands.py +210 -0
  14. ai-life-assistant-copy/backups/backup_20260404_193836/config.py +30 -0
  15. ai-life-assistant-copy/backups/backup_20260404_193836/daemon/__init__.py +3 -0
  16. ai-life-assistant-copy/backups/backup_20260404_193836/daemon/daemon.py +174 -0
  17. ai-life-assistant-copy/backups/backup_20260404_193836/database.py +292 -0
  18. ai-life-assistant-copy/backups/backup_20260404_193836/graph.py +531 -0
  19. ai-life-assistant-copy/backups/backup_20260404_193836/main.py +830 -0
  20. ai-life-assistant-copy/backups/backup_20260404_193836/mcp_tools.py +449 -0
  21. ai-life-assistant-copy/backups/backup_20260404_193836/memory.py +92 -0
  22. ai-life-assistant-copy/backups/backup_20260404_193836/memory_v2.py +333 -0
  23. ai-life-assistant-copy/backups/backup_20260404_193836/mock_shopping_data.py +172 -0
  24. ai-life-assistant-copy/backups/backup_20260404_193836/personality.py +159 -0
  25. ai-life-assistant-copy/backups/backup_20260404_193836/speech.py +41 -0
  26. ai-life-assistant-copy/backups/backup_20260404_193836/test_simple.py +127 -0
  27. ai-life-assistant-copy/backups/backup_20260404_193836/tools/__init__.py +15 -0
  28. ai-life-assistant-copy/backups/backup_20260404_193836/tools/amazon_tool.py +103 -0
  29. ai-life-assistant-copy/backups/backup_20260404_193836/tools/calendar_tool.py +92 -0
  30. ai-life-assistant-copy/backups/backup_20260404_193836/tools/reminder_tool.py +92 -0
  31. ai-life-assistant-copy/backups/backup_20260404_193836/tools/weather_tool.py +45 -0
  32. ai-life-assistant-copy/backups/backup_20260404_193836/tree_memory.py +340 -0
  33. ai-life-assistant-copy/commands.py +210 -0
  34. ai-life-assistant-copy/config.py +30 -0
  35. ai-life-assistant-copy/daemon/__init__.py +3 -0
  36. ai-life-assistant-copy/daemon/daemon.py +174 -0
  37. ai-life-assistant-copy/database.py +292 -0
  38. ai-life-assistant-copy/graph.py +531 -0
  39. ai-life-assistant-copy/main.py +830 -0
  40. ai-life-assistant-copy/mcp_tools.py +449 -0
  41. ai-life-assistant-copy/memory.py +92 -0
  42. ai-life-assistant-copy/memory_v2.py +333 -0
  43. ai-life-assistant-copy/mock_shopping_data.py +172 -0
  44. ai-life-assistant-copy/personality.py +159 -0
  45. ai-life-assistant-copy/speech.py +41 -0
  46. ai-life-assistant-copy/test_simple.py +127 -0
  47. ai-life-assistant-copy/tools/__init__.py +15 -0
  48. ai-life-assistant-copy/tools/amazon_tool.py +103 -0
  49. ai-life-assistant-copy/tools/calendar_tool.py +92 -0
  50. ai-life-assistant-copy/tools/reminder_tool.py +92 -0
  51. ai-life-assistant-copy/tools/weather_tool.py +45 -0
  52. ai-life-assistant-copy/tree_memory.py +340 -0
  53. ai_agent_runtime.py +447 -0
  54. main.py +6752 -0
  55. mcp_server.py +427 -0
@@ -0,0 +1,41 @@
1
+ import os
2
+ from typing import Optional
3
+ from fastapi import UploadFile, File
4
+ import tempfile
5
+
6
+ class SpeechRecognition:
7
+ def __init__(self):
8
+ self.whisper_available = False
9
+ self._check_whisper()
10
+
11
+ def _check_whisper(self):
12
+ try:
13
+ import whisper
14
+ self.whisper_available = True
15
+ self.model = whisper.load_model("base")
16
+ except ImportError:
17
+ print("Whisper not available, speech recognition will be disabled")
18
+ self.whisper_available = False
19
+
20
+ async def transcribe_audio(self, audio_file: UploadFile) -> Optional[str]:
21
+ if not self.whisper_available:
22
+ return None
23
+
24
+ try:
25
+ with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp:
26
+ content = await audio_file.read()
27
+ tmp.write(content)
28
+ tmp_path = tmp.name
29
+
30
+ result = self.model.transcribe(tmp_path)
31
+ text = result.get("text", "")
32
+
33
+ os.unlink(tmp_path)
34
+
35
+ return text
36
+ except Exception as e:
37
+ print(f"Speech recognition error: {e}")
38
+ return None
39
+
40
+
41
+ speech_recognition = SpeechRecognition()
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ 简单的测试脚本 - 不需要 API key 也能测试
5
+ """
6
+
7
+ import sys
8
+ import os
9
+ import threading
10
+ import time
11
+
12
+ # 添加当前目录到路径
13
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
14
+
15
+ # 导入守护进程
16
+ from daemon import LifeAssistantDaemon
17
+
18
+ def start_daemon():
19
+ """启动守护进程"""
20
+ daemon = LifeAssistantDaemon()
21
+ daemon.start()
22
+
23
+ # 运行一段时间后停止
24
+ def stop_after_time():
25
+ time.sleep(60) # 运行 1 分钟
26
+ daemon.stop()
27
+
28
+ threading.Thread(target=stop_after_time, daemon=True).start()
29
+ return daemon
30
+
31
+ print("=" * 60)
32
+ print("AI 生活助手 - 简单测试")
33
+ print("=" * 60)
34
+ print()
35
+
36
+ # 启动守护进程
37
+ print("[系统] 启动生活助手后台服务...")
38
+ daemon = start_daemon()
39
+
40
+ # 模拟简单的聊天功能
41
+ print("🤖 你好!我是你的 AI 生活助手!")
42
+ print()
43
+ print("试试说这些:")
44
+ print(" • '推荐商品' 或 '帮我找手机'")
45
+ print(" • '你好' 或 '谢谢'")
46
+ print(" • '你能做什么'")
47
+ print(" • 输入 '/help' 查看可用命令")
48
+ print(" • 输入 'quit' 或 'exit' 退出")
49
+ print()
50
+ print("=" * 60)
51
+ print()
52
+
53
+ # 简单的对话循环
54
+ conversation_history = []
55
+
56
+ while True:
57
+ try:
58
+ user_input = input("你: ").strip()
59
+
60
+ if user_input.lower() in ['quit', 'exit', '退出', 'q']:
61
+ print()
62
+ print("👋 再见!")
63
+ break
64
+
65
+ if not user_input:
66
+ continue
67
+
68
+ # 保存到历史
69
+ conversation_history.append({"role": "user", "content": user_input})
70
+
71
+ # 处理命令
72
+ if user_input.startswith("/"):
73
+ if user_input == "/help":
74
+ ai_response = "可用命令:\n\n/weather [城市] - 查看天气\n/calendar [日期] - 查看日程\n/calendar add [标题] [时间] - 添加日程\n/reminder [日期] - 查看提醒\n/reminder set [标题] [时间] - 设置提醒\n/shopping [关键词] - 搜索商品\n/food [关键词] - 点外卖\n/taxi [目的地] - 打车\n/flight [出发地] [目的地] - 查机票\n/help - 查看帮助\n\n示例:\n/weather 上海\n/reminder set 吃药 08:00\n/shopping 手机"
75
+ elif user_input.startswith("/weather"):
76
+ city = user_input.split(" ")[1] if len(user_input.split(" ")) > 1 else "北京"
77
+ ai_response = f"{city}的天气:\n当前温度:22°C\n天气:晴\n湿度:45%"
78
+ elif user_input.startswith("/calendar"):
79
+ ai_response = "今日日程:\n09:00 - 团队会议\n14:30 - 客户拜访\n16:00 - 健身"
80
+ elif user_input.startswith("/reminder"):
81
+ if "set" in user_input:
82
+ ai_response = "提醒已设置!\n\n标题: 吃药\n时间: 08:00\n日期: 今天\n重复: 一次性"
83
+ else:
84
+ ai_response = "今日提醒:\n08:00 - 吃药\n14:00 - 会议"
85
+ else:
86
+ ai_response = f"命令 '{user_input}' 已执行!"
87
+ else:
88
+ # 简单的回复逻辑
89
+ user_input_lower = user_input.lower()
90
+
91
+ if any(keyword in user_input_lower for keyword in ['推荐', '找', '商品', '买', '购物', '手机', '电脑', '耳机']):
92
+ ai_response = "好的!让我为你推荐一些商品 🎁\n\n(这是演示版本,完整版本会连接真实的 Amazon API)"
93
+
94
+ elif any(keyword in user_input_lower for keyword in ['你好', 'hi', 'hello', '嗨', '哈喽']):
95
+ ai_response = "你好!我是你的 AI 生活助手!有什么我可以帮你的吗?😊"
96
+
97
+ elif any(keyword in user_input_lower for keyword in ['谢谢', '感谢', 'thanks', 'thank you']):
98
+ ai_response = "不客气!很高兴能帮到你!还有其他需要吗?"
99
+
100
+ elif any(keyword in user_input_lower for keyword in ['你是谁', '你是', 'what are you', 'who are you']):
101
+ ai_response = "我是你的 AI 生活助手!我可以帮你购物、叫外卖、打车、订机票等等!"
102
+
103
+ elif any(keyword in user_input_lower for keyword in ['你能做什么', '帮我', '功能', '可以做什么', 'what can you do']):
104
+ ai_response = "我可以帮你:\n• 🎁 推荐商品\n• 🍔 叫外卖\n• 🚗 打车\n• ✈️ 订机票\n• ☁️ 查天气\n• 📅 管理日程\n• ⏰ 设置提醒\n• 🤖 智能后台服务\n\n(完整版本会有更多功能!)"
105
+
106
+ else:
107
+ ai_response = "我是你的 AI 生活助手!你想让我帮你做什么呢?试试说'推荐商品'或输入'/help'查看命令吧!"
108
+
109
+ # 保存 AI 回复
110
+ conversation_history.append({"role": "assistant", "content": ai_response})
111
+
112
+ print(f"AI: {ai_response}")
113
+ print()
114
+
115
+ except KeyboardInterrupt:
116
+ print()
117
+ print()
118
+ print("👋 再见!")
119
+ break
120
+ except Exception as e:
121
+ print(f"❌ 出错了: {e}")
122
+ print()
123
+
124
+ print()
125
+ print("=" * 60)
126
+ print("测试完成!")
127
+ print("=" * 60)
@@ -0,0 +1,15 @@
1
+ """生活服务工具系统"""
2
+
3
+ from .amazon_tool import search_amazon
4
+ from .weather_tool import get_weather
5
+ from .calendar_tool import get_events, add_event
6
+ from .reminder_tool import set_reminder, get_reminders
7
+
8
+ __all__ = [
9
+ "search_amazon",
10
+ "get_weather",
11
+ "get_events",
12
+ "add_event",
13
+ "set_reminder",
14
+ "get_reminders"
15
+ ]
@@ -0,0 +1,103 @@
1
+ import requests
2
+ from typing import Dict, List, Any
3
+ from config import AMAZON_ASSOCIATE_TAG, AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY
4
+
5
+ def search_amazon(query: str, max_results: int = 5) -> Dict[str, Any]:
6
+ """
7
+ 搜索 Amazon 商品
8
+ 注意:这是一个示例实现,真实使用需要 Amazon Product Advertising API
9
+ """
10
+
11
+ # 示例商品数据(用于演示)
12
+ sample_products = [
13
+ {
14
+ "id": "1",
15
+ "title": "Apple iPhone 15 Pro Max",
16
+ "price": "$1,199.99",
17
+ "image": "https://images.unsplash.com/photo-1592750475338-74b7b21085ab?w=400",
18
+ "url": f"https://www.amazon.com/dp/example?tag={AMAZON_ASSOCIATE_TAG}",
19
+ "rating": 4.8,
20
+ "reviews": 12543
21
+ },
22
+ {
23
+ "id": "2",
24
+ "title": "Sony WH-1000XM5 无线耳机",
25
+ "price": "$398.00",
26
+ "image": "https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400",
27
+ "url": f"https://www.amazon.com/dp/example2?tag={AMAZON_ASSOCIATE_TAG}",
28
+ "rating": 4.9,
29
+ "reviews": 8765
30
+ },
31
+ {
32
+ "id": "3",
33
+ "title": "MacBook Pro 14英寸 M3",
34
+ "price": "$1,999.00",
35
+ "image": "https://images.unsplash.com/photo-1517336714731-489689fd1ca8?w=400",
36
+ "url": f"https://www.amazon.com/dp/example3?tag={AMAZON_ASSOCIATE_TAG}",
37
+ "rating": 4.7,
38
+ "reviews": 5432
39
+ },
40
+ {
41
+ "id": "4",
42
+ "title": "Kindle Paperwhite 电子书阅读器",
43
+ "price": "$139.99",
44
+ "image": "https://images.unsplash.com/photo-1512820790803-83ca734da794?w=400",
45
+ "url": f"https://www.amazon.com/dp/example4?tag={AMAZON_ASSOCIATE_TAG}",
46
+ "rating": 4.6,
47
+ "reviews": 23456
48
+ },
49
+ {
50
+ "id": "5",
51
+ "title": "Instant Pot Duo 7合1 电压力锅",
52
+ "price": "$89.99",
53
+ "image": "https://images.unsplash.com/photo-1556909114-f6e7ad7d3136?w=400",
54
+ "url": f"https://www.amazon.com/dp/example5?tag={AMAZON_ASSOCIATE_TAG}",
55
+ "rating": 4.8,
56
+ "reviews": 156789
57
+ }
58
+ ]
59
+
60
+ # 根据查询词简单过滤
61
+ filtered_products = []
62
+ query_lower = query.lower()
63
+
64
+ for product in sample_products:
65
+ if query_lower in product["title"].lower():
66
+ filtered_products.append(product)
67
+
68
+ # 如果没有匹配,返回所有
69
+ if not filtered_products:
70
+ filtered_products = sample_products[:max_results]
71
+ else:
72
+ filtered_products = filtered_products[:max_results]
73
+
74
+ # 构建卡片格式
75
+ cards = []
76
+ for product in filtered_products:
77
+ cards.append({
78
+ "type": "product",
79
+ "id": product["id"],
80
+ "title": product["title"],
81
+ "price": product["price"],
82
+ "image": product["image"],
83
+ "url": product["url"],
84
+ "rating": product["rating"],
85
+ "reviews": product["reviews"]
86
+ })
87
+
88
+ return {
89
+ "success": True,
90
+ "items": filtered_products,
91
+ "cards": cards,
92
+ "query": query
93
+ }
94
+
95
+ def get_product_details(asin: str) -> Dict[str, Any]:
96
+ """获取商品详情(示例)"""
97
+ return {
98
+ "success": True,
99
+ "asin": asin,
100
+ "title": "示例商品",
101
+ "price": "$99.99",
102
+ "description": "这是一个示例商品描述"
103
+ }
@@ -0,0 +1,92 @@
1
+ """日历工具"""
2
+
3
+ from typing import Dict, Any, List
4
+ import datetime
5
+
6
+ def get_events(date: str = None) -> Dict[str, Any]:
7
+ """获取日程
8
+
9
+ Args:
10
+ date: 日期 (YYYY-MM-DD)
11
+
12
+ Returns:
13
+ 日程信息
14
+ """
15
+ try:
16
+ if date is None:
17
+ date = datetime.datetime.now().strftime("%Y-%m-%d")
18
+
19
+ # 示例数据
20
+ events = [
21
+ {
22
+ "time": "09:00",
23
+ "title": "团队会议",
24
+ "description": "项目进度讨论"
25
+ },
26
+ {
27
+ "time": "14:30",
28
+ "title": "客户拜访",
29
+ "description": "讨论合作方案"
30
+ },
31
+ {
32
+ "time": "16:00",
33
+ "title": "健身",
34
+ "description": "健身房锻炼"
35
+ }
36
+ ]
37
+
38
+ return {
39
+ "success": True,
40
+ "date": date,
41
+ "events": events,
42
+ "cards": [{
43
+ "type": "calendar",
44
+ "title": f"{date}日程",
45
+ "content": "\n".join([f"{event['time']} - {event['title']}" for event in events])
46
+ }]
47
+ }
48
+ except Exception as e:
49
+ return {
50
+ "success": False,
51
+ "error": str(e),
52
+ "cards": []
53
+ }
54
+
55
+ def add_event(title: str, time: str, date: str = None) -> Dict[str, Any]:
56
+ """添加日程
57
+
58
+ Args:
59
+ title: 标题
60
+ time: 时间
61
+ date: 日期 (YYYY-MM-DD)
62
+
63
+ Returns:
64
+ 结果
65
+ """
66
+ try:
67
+ if date is None:
68
+ date = datetime.datetime.now().strftime("%Y-%m-%d")
69
+
70
+ # 示例实现
71
+ event = {
72
+ "title": title,
73
+ "time": time,
74
+ "date": date
75
+ }
76
+
77
+ return {
78
+ "success": True,
79
+ "event": event,
80
+ "message": f"已添加日程: {title} ({time})",
81
+ "cards": [{
82
+ "type": "calendar",
83
+ "title": "日程已添加",
84
+ "content": f"标题: {title}\n时间: {time}\n日期: {date}"
85
+ }]
86
+ }
87
+ except Exception as e:
88
+ return {
89
+ "success": False,
90
+ "error": str(e),
91
+ "cards": []
92
+ }
@@ -0,0 +1,92 @@
1
+ """提醒工具"""
2
+
3
+ from typing import Dict, Any, List
4
+ import datetime
5
+
6
+ def set_reminder(title: str, time: str, date: str = None, repeat: str = None) -> Dict[str, Any]:
7
+ """设置提醒
8
+
9
+ Args:
10
+ title: 提醒标题
11
+ time: 时间
12
+ date: 日期 (YYYY-MM-DD)
13
+ repeat: 重复方式 (daily/weekly/monthly)
14
+
15
+ Returns:
16
+ 结果
17
+ """
18
+ try:
19
+ if date is None:
20
+ date = datetime.datetime.now().strftime("%Y-%m-%d")
21
+
22
+ # 示例实现
23
+ reminder = {
24
+ "title": title,
25
+ "time": time,
26
+ "date": date,
27
+ "repeat": repeat,
28
+ "created_at": datetime.datetime.now().isoformat()
29
+ }
30
+
31
+ return {
32
+ "success": True,
33
+ "reminder": reminder,
34
+ "message": f"已设置提醒: {title} ({time})",
35
+ "cards": [{
36
+ "type": "reminder",
37
+ "title": "提醒已设置",
38
+ "content": f"标题: {title}\n时间: {time}\n日期: {date}\n重复: {repeat or '一次性'}"
39
+ }]
40
+ }
41
+ except Exception as e:
42
+ return {
43
+ "success": False,
44
+ "error": str(e),
45
+ "cards": []
46
+ }
47
+
48
+ def get_reminders(date: str = None) -> Dict[str, Any]:
49
+ """获取提醒
50
+
51
+ Args:
52
+ date: 日期 (YYYY-MM-DD)
53
+
54
+ Returns:
55
+ 提醒列表
56
+ """
57
+ try:
58
+ if date is None:
59
+ date = datetime.datetime.now().strftime("%Y-%m-%d")
60
+
61
+ # 示例数据
62
+ reminders = [
63
+ {
64
+ "title": "吃药",
65
+ "time": "08:00",
66
+ "date": date,
67
+ "repeat": "daily"
68
+ },
69
+ {
70
+ "title": "会议",
71
+ "time": "14:00",
72
+ "date": date,
73
+ "repeat": None
74
+ }
75
+ ]
76
+
77
+ return {
78
+ "success": True,
79
+ "date": date,
80
+ "reminders": reminders,
81
+ "cards": [{
82
+ "type": "reminder",
83
+ "title": f"{date}提醒",
84
+ "content": "\n".join([f"{reminder['time']} - {reminder['title']}" for reminder in reminders])
85
+ }]
86
+ }
87
+ except Exception as e:
88
+ return {
89
+ "success": False,
90
+ "error": str(e),
91
+ "cards": []
92
+ }
@@ -0,0 +1,45 @@
1
+ """天气工具"""
2
+
3
+ import requests
4
+ from typing import Dict, Any
5
+
6
+ def get_weather(location: str = "北京") -> Dict[str, Any]:
7
+ """获取天气信息
8
+
9
+ Args:
10
+ location: 城市名称
11
+
12
+ Returns:
13
+ 天气信息
14
+ """
15
+ try:
16
+ # 使用 OpenWeatherMap API (需要真实的 API key)
17
+ # 这里使用示例数据
18
+ weather_data = {
19
+ "location": location,
20
+ "temperature": "22°C",
21
+ "description": "晴",
22
+ "humidity": "45%",
23
+ "wind": "3级",
24
+ "forecast": [
25
+ {"day": "今天", "temp": "22°C", "desc": "晴"},
26
+ {"day": "明天", "temp": "24°C", "desc": "多云"},
27
+ {"day": "后天", "temp": "20°C", "desc": "小雨"}
28
+ ]
29
+ }
30
+
31
+ return {
32
+ "success": True,
33
+ "data": weather_data,
34
+ "cards": [{
35
+ "type": "weather",
36
+ "title": f"{location}天气",
37
+ "content": f"当前温度: {weather_data['temperature']}\n天气: {weather_data['description']}\n湿度: {weather_data['humidity']}"
38
+ }]
39
+ }
40
+ except Exception as e:
41
+ return {
42
+ "success": False,
43
+ "error": str(e),
44
+ "cards": []
45
+ }