airsltd commited on
Commit
1ca84d9
ยท
1 Parent(s): 44a03f6
__init__.py.willdelete DELETED
@@ -1 +0,0 @@
1
- print('\n\n\n\n\n\n\n\n\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&')
 
 
read.me.md CHANGED
@@ -1 +1,66 @@
1
- conda - google-adk
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ้กน็›ฎ็›ฎๅฝ•็ป“ๆž„ไธŽ่ฏดๆ˜Ž
2
+
3
+ ๆœฌ้กน็›ฎๅŒ…ๅซไปฅไธ‹ไธป่ฆ็›ฎๅฝ•ๅ’Œๆ–‡ไปถ๏ผš
4
+
5
+ ```
6
+ .
7
+ โ”œโ”€โ”€ .gitattributes
8
+ โ”œโ”€โ”€ .gitignore
9
+ โ”œโ”€โ”€ ai_quant_agent.txt
10
+ โ”œโ”€โ”€ cline_code_prompt.txt
11
+ โ”œโ”€โ”€ Dockerfile
12
+ โ”œโ”€โ”€ get_weather_agent.txt
13
+ โ”œโ”€โ”€ push.sh
14
+ โ”œโ”€โ”€ read.me.md
15
+ โ”œโ”€โ”€ README copy.md
16
+ โ”œโ”€โ”€ README.md
17
+ โ”œโ”€โ”€ requirements.txt
18
+ โ”œโ”€โ”€ team_framework/
19
+ โ”‚ โ”œโ”€โ”€ __init__.py
20
+ โ”‚ โ”œโ”€โ”€ api_key_manager.py
21
+ โ”‚ โ”œโ”€โ”€ load_agents.py
22
+ โ”‚ โ”œโ”€โ”€ load_team_config.py
23
+ โ”‚ โ”œโ”€โ”€ load_tools.py
24
+ โ”‚ โ”œโ”€โ”€ supabase_cli.py
25
+ โ”‚ โ””โ”€โ”€ team_quant_rows-20250514.sql
26
+ โ””โ”€โ”€ teams/
27
+ โ””โ”€โ”€ base_team/
28
+ โ”œโ”€โ”€ __init__.py
29
+ โ”œโ”€โ”€ .env.example
30
+ โ”œโ”€โ”€ agent.py
31
+ โ””โ”€โ”€ tools/
32
+ โ”œโ”€โ”€ __init__.py
33
+ โ”œโ”€โ”€ get_current_time.py
34
+ โ””โ”€โ”€ get_weather.py
35
+ ```
36
+
37
+ ## ๆ–‡ไปถๅ’Œ็›ฎๅฝ•่ฏดๆ˜Ž
38
+
39
+ * `.gitattributes`: Git ๅฑžๆ€งๆ–‡ไปถ๏ผŒ็”จไบŽๅฎšไน‰ๆ–‡ไปถๅฆ‚ไฝ•่ขซ Git ๅค„็†๏ผˆไพ‹ๅฆ‚๏ผŒ่กŒๅฐพ็ฌฆ๏ผ‰ใ€‚
40
+ * `.gitignore`: Git ๅฟฝ็•ฅๆ–‡ไปถ๏ผŒๅˆ—ๅ‡บไบ†ไธๅบ”่ขซ Git ่ทŸ่ธช็š„ๆ–‡ไปถๅ’Œ็›ฎๅฝ•ใ€‚
41
+ * `ai_quant_agent.txt`: ๅฏ่ƒฝๆ˜ฏไธŽ AI ้‡ๅŒ–ไปฃ็†็›ธๅ…ณ็š„ๆ–‡ๆœฌๆ–‡ไปถ๏ผŒๅฏ่ƒฝๅŒ…ๅซ้…็ฝฎๆˆ–ๆ็คบไฟกๆฏใ€‚
42
+ * `cline_code_prompt.txt`: ๅฏ่ƒฝๆ˜ฏ็”จไบŽไปฃ็ ็”Ÿๆˆ็š„ๆ็คบๆ–‡ๆœฌๆ–‡ไปถใ€‚
43
+ * `Dockerfile`: Docker ้•œๅƒๆž„ๅปบๆ–‡ไปถ๏ผŒๅฎšไน‰ไบ†ๅฆ‚ไฝ•ๆž„ๅปบ้กน็›ฎ็š„ Docker ้•œๅƒใ€‚
44
+ * `get_weather_agent.txt`: ๅฏ่ƒฝๆ˜ฏไธŽ่Žทๅ–ๅคฉๆฐ”ไปฃ็†็›ธๅ…ณ็š„ๆ–‡ๆœฌๆ–‡ไปถ๏ผŒๅฏ่ƒฝๅŒ…ๅซ้…็ฝฎๆˆ–ๆ็คบไฟกๆฏใ€‚
45
+ * `push.sh`: Shell ่„šๆœฌ๏ผŒๅฏ่ƒฝ็”จไบŽๆž„ๅปบๅ’ŒๆŽจ้€ Docker ้•œๅƒๆˆ–ไปฃ็ ๅˆฐไป“ๅบ“ใ€‚
46
+ * `read.me.md`: ๆœฌๆ–‡ไปถ๏ผŒๆไพ›้กน็›ฎ็š„็›ฎๅฝ•็ป“ๆž„ๅ’Œ่ฏดๆ˜Žใ€‚
47
+ * `README copy.md`, `README.md`: ้กน็›ฎ็š„ๆ น README ๆ–‡ไปถ๏ผŒ้€šๅธธๅŒ…ๅซ้กน็›ฎ็š„ไป‹็ปใ€ๅฎ‰่ฃ…ๅ’Œไฝฟ็”จ่ฏดๆ˜Žใ€‚
48
+ * `requirements.txt`: Python ไพ่ต–ๆ–‡ไปถ๏ผŒๅˆ—ๅ‡บไบ†้กน็›ฎๆ‰€้œ€็š„ๆ‰€ๆœ‰ Python ๅŒ…ใ€‚
49
+ * `team_framework/`: ๅ›ข้˜Ÿๆก†ๆžถ็š„ๆ ธๅฟƒไปฃ็ ็›ฎๅฝ•ใ€‚
50
+ * `__init__.py`: Python ๅŒ…็š„ๅˆๅง‹ๅŒ–ๆ–‡ไปถใ€‚
51
+ * `api_key_manager.py`: ่ดŸ่ดฃ็ฎก็† API ๅฏ†้’ฅ็š„ๆจกๅ—ใ€‚
52
+ * `load_agents.py`: ่ดŸ่ดฃๅŠ ่ฝฝไปฃ็†้…็ฝฎๅ’Œๅฎž็Žฐ็š„ๆจกๅ—ใ€‚
53
+ * `load_team_config.py`: ่ดŸ่ดฃๅŠ ่ฝฝๅ›ข้˜Ÿ้…็ฝฎ็š„ๆจกๅ—ใ€‚
54
+ * `load_tools.py`: ่ดŸ่ดฃๅŠ ่ฝฝๅทฅๅ…ท็š„ๆจกๅ—ใ€‚
55
+ * `supabase_cli.py`: ไธŽ Supabase ๅ‘ฝไปค่กŒๆŽฅๅฃไบคไบ’็›ธๅ…ณ็š„ๆจกๅ—ใ€‚
56
+ * `team_quant_rows-20250514.sql`: SQL ๆ–‡ไปถ๏ผŒๅฏ่ƒฝๅŒ…ๅซๆ•ฐๆฎๅบ“ๆจกๅผๅฎšไน‰ๆˆ–ๅˆๅง‹ๆ•ฐๆฎ๏ผŒๆ—ฅๆœŸๅŽ็ผ€่กจ็คบๅฏ่ƒฝๆ˜ฏๆŸไธชๆ—ถ้—ด็‚น็š„ๅฟซ็…งๆˆ–่ฟ็งปใ€‚
57
+ * `teams/`: ๅญ˜ๆ”พไธๅŒๅ›ข้˜Ÿ้…็ฝฎๅ’Œไปฃ็ ็š„็›ฎๅฝ•ใ€‚
58
+ * `base_team/`: ๅŸบ็ก€ๅ›ข้˜Ÿ็š„้…็ฝฎๅ’Œไปฃ็ ็›ฎๅฝ•ใ€‚ๆ ธๅฟƒๅฟ…้กปๅŒ…ๆ‹ฌไธ‰ไธชๆ–‡ไปถ๏ผš__init__.pyใ€.envใ€agent.py
59
+ * `__init__.py`: Python ๅŒ…็š„ๅˆๅง‹ๅŒ–ๆ–‡ไปถใ€‚
60
+ * `.env`: ็Žฏๅขƒๅ˜้‡ๆ–‡ไปถ๏ผŒๅฝ“ๅ‰ๅ›ข้˜Ÿๆ‰€้œ€็š„้…็ฝฎ้กนใ€‚
61
+ * `.env.example`: ็Žฏๅขƒๅ˜้‡็คบไพ‹ๆ–‡ไปถ๏ผŒ่ฏดๆ˜Žไบ†่ฟ่กŒๆญคๅ›ข้˜Ÿๆ‰€้œ€็š„้…็ฝฎ้กนใ€‚
62
+ * `agent.py`: ๅŸบ็ก€ๅ›ข้˜Ÿ็š„ไปฃ็†้€ป่พ‘ๅฎž็Žฐใ€‚
63
+ * `tools/`: ๏ผˆๅฏ้€‰๏ผ‰ๅŸบ็ก€ๅ›ข้˜Ÿไฝฟ็”จ็š„ๅทฅๅ…ทๆจกๅ—็›ฎๅฝ•ใ€‚ใ€ๅผบ็ƒˆๅปบ่ฎฎ้€‰็”จๆˆ็†Ÿ็š„MCPใ€ๆˆ–่€…่‡ชๅฎšไน‰ๅผ€ๅ‘MCP๏ผŒๅนถไฝฟ็”จMCP่ฟ›่กŒ่ฐƒ็”จใ€‘
64
+ * `__init__.py`: Python ๅŒ…็š„ๅˆๅง‹ๅŒ–ๆ–‡ไปถใ€‚
65
+ * `get_current_time.py`: ่Žทๅ–ๅฝ“ๅ‰ๆ—ถ้—ด็š„ๅทฅๅ…ทๅฎž็Žฐใ€‚
66
+ * `get_weather.py`: ่Žทๅ–ๅคฉๆฐ”็š„ๅทฅๅ…ทๅฎž็Žฐใ€‚
teams/base_team/cache.py DELETED
@@ -1,107 +0,0 @@
1
- import os
2
- from supabase import create_client, Client
3
- import time
4
- from dotenv import load_dotenv
5
-
6
- load_dotenv()
7
-
8
- # Simple in-memory cache
9
- api_key_cache = {}
10
- last_loaded_time = 0
11
- CACHE_TTL = 300 # Cache time-to-live in seconds (5 minutes)
12
-
13
- def get_supabase_client() -> Client:
14
- """Initializes and returns a Supabase client."""
15
- url: str = os.environ.get("SUPABASE_URL")
16
- key: str = os.environ.get("SUPABASE_KEY")
17
- if not url or not key:
18
- print("Supabase URL or Key not found in environment variables.")
19
- return None
20
- return create_client(url, key)
21
-
22
- def load_api_keys_from_db():
23
- """Loads API keys from the database into the cache."""
24
- global api_key_cache
25
-
26
- print("Loading API keys from database...")
27
- supabase: Client = get_supabase_client()
28
- if not supabase:
29
- return {}
30
-
31
- try:
32
- response = supabase.from_("app_config").select("config").eq("id", 1).execute()
33
- #[
34
- # {
35
- # 'config': {
36
- # 'api_keys': [
37
- # {'api_key': 'xxxxx', 'can_use_at': 0},
38
- # {'api_key': 'yyyyy', 'can_use_at': 0}
39
- # ]
40
- # }
41
- # }
42
- #]
43
- # print(f"Supabase response data: {response.data}")
44
-
45
- if response.data and response.data[0] and 'config' in response.data[0] and 'api_keys' in response.data[0]['config']:
46
- api_keys_list = response.data[0]['config']['api_keys']
47
- if api_keys_list:
48
- api_key_cache = {item['api_key']: item['can_use_at'] for item in api_keys_list}
49
- # {'xxxxx': 0, 'yyyyy': 0}
50
- # print(f"Successfully loaded {len(api_key_cache)} API keys with can_use_at timestamps.")
51
- # print(f"API keys cache: {api_key_cache}")
52
- else:
53
- print("API keys list is empty in the database response.")
54
- api_key_cache = {}
55
- else:
56
- print("Unexpected database response structure or no data found.")
57
- api_key_cache = {}
58
-
59
- except Exception as e:
60
- print(f"Error loading API keys from database: {e}")
61
- api_key_cache = {} # Clear cache on error
62
-
63
- return api_key_cache
64
-
65
- def get_api_key():
66
- """Gets an API key from the cache, loading from DB if necessary."""
67
- global api_key_cache
68
- # print("\n\n\n\n\nGetting API key...")
69
- # print(api_key_cache)
70
-
71
- # Ensure cache is loaded
72
- if not api_key_cache :
73
- load_api_keys_from_db()
74
- # api_key_cache={'xxxxx': 1, 'yyyyy': 0}
75
- # print('api_key_cache',api_key_cache)
76
-
77
- # Sort available keys by their 'can_use_at' timestamp in ascending order
78
- sorted_key_cache = sorted(api_key_cache, key=lambda key: api_key_cache.get(key, float('inf')))
79
- # print('\n\n\n\n\n\n\n\n\nsorted_key_cache',sorted_key_cache)
80
-
81
- # Select the key with the smallest 'can_use_at' value
82
- selected_key = sorted_key_cache[0]
83
-
84
- # TODO: Update the 'can_use_at' timestamp for the selected key in the cache
85
- # This requires knowing the rate limit or delay period for the API.
86
- # For now, we'll just return the key. In a real system, you'd update the cache
87
- # with a future timestamp after using the key successfully.
88
- # Example: api_key_cache[selected_key] = time.time() + API_RATE_LIMIT_DELAY
89
-
90
- # print(f"Using API key: {selected_key[:5]}...") # Print partial key for security
91
- api_key_cache[selected_key]=time.time()
92
- return selected_key
93
-
94
- # Example usage (for testing)
95
- if __name__ == "__main__":
96
- # In a real application, environment variables would be set
97
- # For testing, you might set them here or use a .env file loader
98
- # os.environ['SUPABASE_URL'] = 'your_supabase_url'
99
- # os.environ['SUPABASE_KEY'] = 'your_supabase_key'
100
-
101
- # keys = load_api_keys_from_db()
102
- # print("Loaded keys:", keys)
103
-
104
- # # Simulate using cached keys
105
- # keys = load_api_keys_from_db()
106
- # print("Loaded keys (from cache):", keys)
107
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
version.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ v0.1.0
ai_quant_agent.txt โ†’ ๅ‚่€ƒๆ•ฐๆฎๅŒ…็ป“ๆž„/ai_quant_agent.txt RENAMED
File without changes
cline_code_prompt.txt โ†’ ๅ‚่€ƒๆ•ฐๆฎๅŒ…็ป“ๆž„/cline_code_prompt.txt RENAMED
File without changes
get_weather_agent.txt โ†’ ๅ‚่€ƒๆ•ฐๆฎๅŒ…็ป“ๆž„/get_weather_agent.txt RENAMED
File without changes