MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / handleAitcCommand

Function handleAitcCommand

aitc/aitc.ts:208–494  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

206 msg.edit({
207 text,
208 parseMode: "html",
209 linkPreview: false,
210 });
211
212 const replyPlainText = async (text: string) =>
213 msg.edit({
214 text: sanitizePlainText(text),
215 linkPreview: false,
216 });
217
218 if (!trimmed) {
219 await replyWith(
220 "ℹ️ <b>aitc 插件</b>\n\n" +
221 "• <code>aitc key <API Key></code> - 设置API Key\n" +
222 "• <code>aitc url <地址></code> - 自定义API地址\n" +
223 "• <code>aitc model <模型名></code> - 指定模型\n" +
224 `• <code>aitc temp <${TEMPERATURE_RANGE_LABEL}></code> - 调整温度\n` +
225 "• <code>aitc prompt <系统Prompt></code> - 定义默认Prompt\n" +
226 "• <code>aitc spn <简称> <Prompt文本></code> - 保存或更新Prompt预设 (set prompt name)\n" +
227 "• <code>aitc <简称> [文本]</code> - 使用预设Prompt处理文本\n" +
228 "• <code>aitc [文本]</code> - 使用默认Prompt处理文本\n" +
229 "• <code>aitc info</code> - 查看当前配置",
230 );
231 return;
232 }
233
234 const subcommandToken = parts[0] || "";
235 const subcommandValue = rest.slice(subcommandToken.length).trimStart();
236
237 switch (subcommand) {
238 case "key":
239 case "apikey":
240 case "_set_key": {
241 if (!subcommandValue) {
242 await replyWith("❌ <b>请提供API Key</b>");
243 return;
244 }
245 ConfigManager.set(CONFIG_KEYS.API_KEY, subcommandValue.trim());
246 await replyWith("✅ <b>API Key已更新</b>");
247 return;
248 }
249 case "url":
250 case "api":
251 case "_set_url":
252 case "_set_api": {
253 if (!subcommandValue) {
254 await replyWith("❌ <b>请提供API地址</b>");
255 return;
256 }
257 ConfigManager.set(
258 CONFIG_KEYS.API_URL,
259 trimTrailingSlash(subcommandValue.trim()),
260 );
261 await replyWith("✅ <b>API地址已更新</b>");
262 return;
263 }
264 case "model":
265 case "_set_model": {

Callers

nothing calls this directly

Calls 10

replyWithFunction · 0.85
trimTrailingSlashFunction · 0.85
clampTemperatureFunction · 0.85
replyPlainTextFunction · 0.85
setPromptMethod · 0.80
getPromptMapMethod · 0.80
errorMethod · 0.80
htmlEscapeFunction · 0.70
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected