(msg: Api.Message)
| 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": { |
nothing calls this directly
no test coverage detected