Spaces:
Running
Running
Commit
·
fa7dc28
1
Parent(s):
0267618
Geo_update
Browse files
features/mcp/agent_bridge.py
CHANGED
|
@@ -637,7 +637,9 @@ class MCPAgentBridge:
|
|
| 637 |
Rules:
|
| 638 |
1. If the user's request can be solved with a tool, select the most appropriate tool
|
| 639 |
2. Only skip tool selection for pure greetings (hi, hello) or meta questions (what can you do)
|
| 640 |
-
3. Extract tool parameters from user message
|
|
|
|
|
|
|
| 641 |
4. User may speak in ANY language (Chinese, English, Korean, Japanese, Indonesian, Vietnamese, etc.) - always try to match their intent to available tools
|
| 642 |
|
| 643 |
【IMPORTANT】Weather/News/Exchange queries in ANY language should trigger tools:
|
|
|
|
| 637 |
Rules:
|
| 638 |
1. If the user's request can be solved with a tool, select the most appropriate tool
|
| 639 |
2. Only skip tool selection for pure greetings (hi, hello) or meta questions (what can you do)
|
| 640 |
+
3. Extract tool parameters from user message
|
| 641 |
+
- If user doesn't specify a location for weather/directions/transit queries, leave city/lat/lon EMPTY (system will auto-fill from user's GPS)
|
| 642 |
+
- If user specifies a city name, always convert to English (台北→Taipei, 東京→Tokyo)
|
| 643 |
4. User may speak in ANY language (Chinese, English, Korean, Japanese, Indonesian, Vietnamese, etc.) - always try to match their intent to available tools
|
| 644 |
|
| 645 |
【IMPORTANT】Weather/News/Exchange queries in ANY language should trigger tools:
|
features/mcp/tools/geocode_tool.py
CHANGED
|
@@ -118,7 +118,7 @@ class ReverseGeocodeTool(MCPTool):
|
|
| 118 |
data = None
|
| 119 |
try:
|
| 120 |
async with aiohttp.ClientSession(headers=headers) as session:
|
| 121 |
-
async with session.get(url, params=params, timeout=
|
| 122 |
if resp.status != 200:
|
| 123 |
raise ExecutionError(f"Nominatim 失敗: HTTP {resp.status}")
|
| 124 |
|
|
|
|
| 118 |
data = None
|
| 119 |
try:
|
| 120 |
async with aiohttp.ClientSession(headers=headers) as session:
|
| 121 |
+
async with session.get(url, params=params, timeout=30) as resp:
|
| 122 |
if resp.status != 200:
|
| 123 |
raise ExecutionError(f"Nominatim 失敗: HTTP {resp.status}")
|
| 124 |
|
services/realtime_stt_service.py
CHANGED
|
@@ -166,7 +166,7 @@ class RealtimeSTTService:
|
|
| 166 |
"silence_duration_ms": 500
|
| 167 |
},
|
| 168 |
"input_audio_noise_reduction": {
|
| 169 |
-
"type": "
|
| 170 |
}
|
| 171 |
}
|
| 172 |
}
|
|
|
|
| 166 |
"silence_duration_ms": 500
|
| 167 |
},
|
| 168 |
"input_audio_noise_reduction": {
|
| 169 |
+
"type": "near_field"
|
| 170 |
}
|
| 171 |
}
|
| 172 |
}
|
static/frontend/index.html
CHANGED
|
@@ -242,6 +242,7 @@
|
|
| 242 |
|
| 243 |
/* 花蕊中心(精緻珍珠球體設計,位於花瓣下方)*/
|
| 244 |
.bloom-core {
|
|
|
|
| 245 |
position: absolute;
|
| 246 |
top: 50%;
|
| 247 |
left: 50%;
|
|
@@ -306,16 +307,16 @@
|
|
| 306 |
|
| 307 |
@keyframes coreBreath {
|
| 308 |
0%, 100% {
|
| 309 |
-
transform: translate(-50%, -50%) scale(1) rotate(0deg);
|
| 310 |
-
box-shadow:
|
| 311 |
0 3px 12px rgba(251, 191, 36, 0.3),
|
| 312 |
0 1px 4px rgba(251, 191, 36, 0.2),
|
| 313 |
inset 0 2px 6px rgba(255, 255, 255, 0.6),
|
| 314 |
inset 0 -2px 6px rgba(245, 158, 11, 0.3);
|
| 315 |
}
|
| 316 |
50% {
|
| 317 |
-
transform: translate(-50%, -50%) scale(1.05) rotate(2deg);
|
| 318 |
-
box-shadow:
|
| 319 |
0 4px 16px rgba(251, 191, 36, 0.4),
|
| 320 |
0 2px 6px rgba(251, 191, 36, 0.3),
|
| 321 |
inset 0 3px 8px rgba(255, 255, 255, 0.7),
|
|
@@ -1490,14 +1491,18 @@
|
|
| 1490 |
#tool-cards-container { display: none !important; }
|
| 1491 |
.tool-drawer-toggle.visible { display: flex; }
|
| 1492 |
.tool-drawer { display: flex; }
|
| 1493 |
-
|
| 1494 |
/* 花朵縮小 */
|
| 1495 |
.voice-waveform-container { width: 280px; height: 280px; }
|
| 1496 |
.voice-mic-container { width: 180px; height: 180px; }
|
| 1497 |
-
.bloom-core {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1498 |
.bloom-petal:nth-child(-n+8) { width: 50px; height: 80px; }
|
| 1499 |
.bloom-petal:nth-child(n+9) { width: 38px; height: 65px; }
|
| 1500 |
-
|
| 1501 |
/* 文字輸出區域 */
|
| 1502 |
.voice-agent-output { max-width: 90vw; font-size: 14px; padding: 16px 20px; }
|
| 1503 |
}
|
|
@@ -1528,7 +1533,7 @@
|
|
| 1528 |
#tool-cards-container { display: none !important; }
|
| 1529 |
.tool-drawer-toggle.visible { display: flex; }
|
| 1530 |
.tool-drawer { display: flex; }
|
| 1531 |
-
|
| 1532 |
/* 花朵響應式放大(根據視窗高度)*/
|
| 1533 |
.voice-waveform-container {
|
| 1534 |
width: min(50vh, 500px);
|
|
@@ -1541,6 +1546,7 @@
|
|
| 1541 |
.bloom-core {
|
| 1542 |
width: min(5vh, 45px);
|
| 1543 |
height: min(5vh, 45px);
|
|
|
|
| 1544 |
}
|
| 1545 |
.bloom-petal:nth-child(-n+8) {
|
| 1546 |
width: min(8vh, 80px);
|
|
@@ -1550,7 +1556,7 @@
|
|
| 1550 |
width: min(6vh, 60px);
|
| 1551 |
height: min(10vh, 100px);
|
| 1552 |
}
|
| 1553 |
-
|
| 1554 |
/* 文字輸出區域適配 */
|
| 1555 |
.voice-agent-output {
|
| 1556 |
max-width: 80vw;
|
|
@@ -1562,7 +1568,11 @@
|
|
| 1562 |
@media (min-width: 1921px) {
|
| 1563 |
.voice-waveform-container { width: 500px; height: 500px; }
|
| 1564 |
.voice-mic-container { width: 300px; height: 300px; }
|
| 1565 |
-
.bloom-core {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1566 |
.bloom-petal:nth-child(-n+8) { width: 80px; height: 130px; }
|
| 1567 |
.bloom-petal:nth-child(n+9) { width: 60px; height: 100px; }
|
| 1568 |
}
|
|
@@ -1579,6 +1589,9 @@
|
|
| 1579 |
width: min(30vh, 300px);
|
| 1580 |
height: min(30vh, 300px);
|
| 1581 |
}
|
|
|
|
|
|
|
|
|
|
| 1582 |
</style>
|
| 1583 |
</head>
|
| 1584 |
<body>
|
|
|
|
| 242 |
|
| 243 |
/* 花蕊中心(精緻珍珠球體設計,位於花瓣下方)*/
|
| 244 |
.bloom-core {
|
| 245 |
+
--core-scale: 1; /* 預設縮放比例,可由 media query 覆蓋 */
|
| 246 |
position: absolute;
|
| 247 |
top: 50%;
|
| 248 |
left: 50%;
|
|
|
|
| 307 |
|
| 308 |
@keyframes coreBreath {
|
| 309 |
0%, 100% {
|
| 310 |
+
transform: translate(-50%, -50%) scale(calc(var(--core-scale) * 1)) rotate(0deg);
|
| 311 |
+
box-shadow:
|
| 312 |
0 3px 12px rgba(251, 191, 36, 0.3),
|
| 313 |
0 1px 4px rgba(251, 191, 36, 0.2),
|
| 314 |
inset 0 2px 6px rgba(255, 255, 255, 0.6),
|
| 315 |
inset 0 -2px 6px rgba(245, 158, 11, 0.3);
|
| 316 |
}
|
| 317 |
50% {
|
| 318 |
+
transform: translate(-50%, -50%) scale(calc(var(--core-scale) * 1.05)) rotate(2deg);
|
| 319 |
+
box-shadow:
|
| 320 |
0 4px 16px rgba(251, 191, 36, 0.4),
|
| 321 |
0 2px 6px rgba(251, 191, 36, 0.3),
|
| 322 |
inset 0 3px 8px rgba(255, 255, 255, 0.7),
|
|
|
|
| 1491 |
#tool-cards-container { display: none !important; }
|
| 1492 |
.tool-drawer-toggle.visible { display: flex; }
|
| 1493 |
.tool-drawer { display: flex; }
|
| 1494 |
+
|
| 1495 |
/* 花朵縮小 */
|
| 1496 |
.voice-waveform-container { width: 280px; height: 280px; }
|
| 1497 |
.voice-mic-container { width: 180px; height: 180px; }
|
| 1498 |
+
.bloom-core {
|
| 1499 |
+
width: 28px;
|
| 1500 |
+
height: 28px;
|
| 1501 |
+
--core-scale: 0.8; /* 28/35 = 0.8 */
|
| 1502 |
+
}
|
| 1503 |
.bloom-petal:nth-child(-n+8) { width: 50px; height: 80px; }
|
| 1504 |
.bloom-petal:nth-child(n+9) { width: 38px; height: 65px; }
|
| 1505 |
+
|
| 1506 |
/* 文字輸出區域 */
|
| 1507 |
.voice-agent-output { max-width: 90vw; font-size: 14px; padding: 16px 20px; }
|
| 1508 |
}
|
|
|
|
| 1533 |
#tool-cards-container { display: none !important; }
|
| 1534 |
.tool-drawer-toggle.visible { display: flex; }
|
| 1535 |
.tool-drawer { display: flex; }
|
| 1536 |
+
|
| 1537 |
/* 花朵響應式放大(根據視窗高度)*/
|
| 1538 |
.voice-waveform-container {
|
| 1539 |
width: min(50vh, 500px);
|
|
|
|
| 1546 |
.bloom-core {
|
| 1547 |
width: min(5vh, 45px);
|
| 1548 |
height: min(5vh, 45px);
|
| 1549 |
+
--core-scale: 1.29; /* 45/35 = 1.29 (max scale) */
|
| 1550 |
}
|
| 1551 |
.bloom-petal:nth-child(-n+8) {
|
| 1552 |
width: min(8vh, 80px);
|
|
|
|
| 1556 |
width: min(6vh, 60px);
|
| 1557 |
height: min(10vh, 100px);
|
| 1558 |
}
|
| 1559 |
+
|
| 1560 |
/* 文字輸出區域適配 */
|
| 1561 |
.voice-agent-output {
|
| 1562 |
max-width: 80vw;
|
|
|
|
| 1568 |
@media (min-width: 1921px) {
|
| 1569 |
.voice-waveform-container { width: 500px; height: 500px; }
|
| 1570 |
.voice-mic-container { width: 300px; height: 300px; }
|
| 1571 |
+
.bloom-core {
|
| 1572 |
+
width: 45px;
|
| 1573 |
+
height: 45px;
|
| 1574 |
+
--core-scale: 1.29; /* 45/35 = 1.29 */
|
| 1575 |
+
}
|
| 1576 |
.bloom-petal:nth-child(-n+8) { width: 80px; height: 130px; }
|
| 1577 |
.bloom-petal:nth-child(n+9) { width: 60px; height: 100px; }
|
| 1578 |
}
|
|
|
|
| 1589 |
width: min(30vh, 300px);
|
| 1590 |
height: min(30vh, 300px);
|
| 1591 |
}
|
| 1592 |
+
body.portrait-mode .bloom-core {
|
| 1593 |
+
--core-scale: 1.29; /* 與直立螢幕模式一致 */
|
| 1594 |
+
}
|
| 1595 |
</style>
|
| 1596 |
</head>
|
| 1597 |
<body>
|