refactor: ClawBot → OpenClaw 全域更名
- 刪除舊版 clawbot.py (已有新版 openclaw.py) - 更新 models/ai.py 類型定義 (ClawBotAnalysisRequest/Response) - 更新 api/v1/ai.py import 與註解 - 更新 Discord username - 更新所有註解與文檔 依據: feedback_openclaw_naming.md (統帥 2026-03-20 正式命名決議) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ Phase 3.3: 商業變現能力 - Day-1 ROI
|
||||
|
||||
輸出格式:
|
||||
- total_wasted_usd: 每月浪費金額
|
||||
- recommended_actions: ClawBot 可執行的建議清單
|
||||
- recommended_actions: OpenClaw 可執行的建議清單
|
||||
"""
|
||||
|
||||
import logging
|
||||
@@ -78,7 +78,7 @@ class SavingsType(str, Enum):
|
||||
|
||||
@dataclass
|
||||
class RecommendedAction:
|
||||
"""建議的優化動作 (ClawBot 可執行)"""
|
||||
"""建議的優化動作 (OpenClaw 可執行)"""
|
||||
action_id: str
|
||||
action_type: Literal["delete", "scale_down", "resize", "migrate"]
|
||||
resource_type: ResourceType
|
||||
@@ -87,7 +87,7 @@ class RecommendedAction:
|
||||
description: str
|
||||
estimated_savings_usd: float
|
||||
risk_level: Literal["low", "medium", "high", "critical"]
|
||||
command_hint: str # 給 ClawBot 的執行提示
|
||||
command_hint: str # 給 OpenClaw 的執行提示
|
||||
savings_type: SavingsType = SavingsType.REALIZABLE # 節省類型
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
@@ -107,7 +107,7 @@ class RecommendedAction:
|
||||
|
||||
@dataclass
|
||||
class CostReport:
|
||||
"""成本報告 (ClawBot 整合用)"""
|
||||
"""成本報告 (OpenClaw 整合用)"""
|
||||
scan_id: str
|
||||
scanned_at: datetime
|
||||
cluster_name: str
|
||||
@@ -126,13 +126,13 @@ class CostReport:
|
||||
waste_by_namespace: dict[str, float]
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
"""輸出 ClawBot 可讀取的 JSON 格式"""
|
||||
"""輸出 OpenClaw 可讀取的 JSON 格式"""
|
||||
return {
|
||||
"scanId": self.scan_id,
|
||||
"scannedAt": self.scanned_at.isoformat(),
|
||||
"clusterName": self.cluster_name,
|
||||
|
||||
# ClawBot 核心關注
|
||||
# OpenClaw 核心關注
|
||||
"totalWastedUsd": round(self.total_wasted_usd, 2),
|
||||
"totalResourcesScanned": self.total_resources_scanned,
|
||||
"wastedResourcesCount": self.wasted_resources_count,
|
||||
@@ -217,7 +217,7 @@ class IdleResourceScanner:
|
||||
閒置資源掃描器
|
||||
|
||||
偵測並量化 K8s 叢集中的浪費資源,
|
||||
轉換為美金金額,供 ClawBot 決策
|
||||
轉換為美金金額,供 OpenClaw 決策
|
||||
"""
|
||||
|
||||
def __init__(self, pricing: PricingConfig | None = None):
|
||||
@@ -490,7 +490,7 @@ class IdleResourceScanner:
|
||||
wasted: list[WastedResource],
|
||||
) -> list[RecommendedAction]:
|
||||
"""
|
||||
產生優化建議 (ClawBot 可執行)
|
||||
產生優化建議 (OpenClaw 可執行)
|
||||
"""
|
||||
actions = []
|
||||
action_counter = 0
|
||||
@@ -585,7 +585,7 @@ class IdleResourceScanner:
|
||||
╚════════════════════════════════════════════════════════════════╝
|
||||
|
||||
Returns:
|
||||
ClawBot 可直接使用的 JSON 格式
|
||||
OpenClaw 可直接使用的 JSON 格式
|
||||
"""
|
||||
realizable = sum(
|
||||
a.estimated_savings_usd
|
||||
|
||||
Reference in New Issue
Block a user