MCPcopy Create free account
hub / github.com/Qinbf/groundmap / typeLabel

Function typeLabel

tools/debug-console/components/FlowNode.tsx:110–124  ·  view source on GitHub ↗

卡片内部的类型标签(取代 FILE_COLOR.unknown 的 "?")

(data: FlowNodeData, t: TFn)

Source from the content-addressed store, hash-verified

108
109/** 卡片内部的类型标签(取代 FILE_COLOR.unknown 的 "?") */
110function typeLabel(data: FlowNodeData, t: TFn): string {
111 if (data.kind === "file") {
112 const key = FILE_TYPE_KEY[data.fileType];
113 return key ? t(key) : t("flow.type_file");
114 }
115 if (data.kind === "search") return t("flow.type_search");
116 if (data.kind === "list") return t("flow.type_list");
117 if (data.kind === "other" && data.toolName) {
118 // 工具名是机器标识符(snake_case),不翻译;只做可读化
119 const name = data.toolName;
120 if (name.startsWith("list_")) return name.replace("list_", "");
121 return name;
122 }
123 return data.kind;
124}
125
126function badgeTooltip(data: FlowNodeData): string {
127 if (data.kind === "file") return `file type: ${data.fileType}`;

Callers 1

renderToolFunction · 0.70

Calls 1

tFunction · 0.50

Tested by

no test coverage detected