This commit is contained in:
van
2026-04-23 22:20:34 +08:00
parent acd693f122
commit 66aa339906
3 changed files with 10 additions and 15 deletions

View File

@@ -237,7 +237,7 @@ jarvis:
# wait_reply 时服务端会等多条 Bot 回复,宜适当加大 # wait_reply 时服务端会等多条 Bot 回复,宜适当加大
read-timeout-ms: 120000 read-timeout-ms: 120000
wait-reply: true wait-reply: true
# reply_take_nth 由 Java 按 bot 固定:开(AJL05_bot)=2慢开(QingBao)=3 # reply_take_nth:仅「开」用 2「慢开」由 tg_bridge reply_adaptive_skip_middle_ad 在 2/3 条间自适应
# Ollama 大模型服务(监控健康度调试用) # Ollama 大模型服务(监控健康度调试用)
ollama: ollama:
base-url: http://192.168.8.34:11434 base-url: http://192.168.8.34:11434

View File

@@ -226,7 +226,7 @@ jarvis:
connect-timeout-ms: 8000 connect-timeout-ms: 8000
read-timeout-ms: 120000 read-timeout-ms: 120000
wait-reply: true wait-reply: true
# reply_take_nthJava 按 bot 固定(开=2慢开=3 # 「开」取第 2 条;「慢开」由桥接自适应第 2/3 条
# Ollama 大模型服务(监控健康度调试用) # Ollama 大模型服务(监控健康度调试用)
ollama: ollama:
base-url: http://192.168.8.34:11434 base-url: http://192.168.8.34:11434

View File

@@ -21,8 +21,9 @@ import java.util.regex.Pattern;
* 企微「开」/「慢开」+ 手机号POST 局域网 /v1/forwardbody 含 {@code text}(手机号)与 {@code bot} * 企微「开」/「慢开」+ 手机号POST 局域网 /v1/forwardbody 含 {@code text}(手机号)与 {@code bot}
* 将 JSON 中的 {@code reply_text} 作为回显。 * 将 JSON 中的 {@code reply_text} 作为回显。
* <p> * <p>
* {@code wait_reply} 时按 Bot 取第 N 条回复{@code AJL05_bot} 第 2 条{@code QingBaoJuXWsgkbot} 为第 3 条; * {@code wait_reply} 时:{@code AJL05_bot} 固定取第 2 条{@code QingBaoJuXWsgkbot} 由 tg_bridge
* 「慢开」返回正文会去掉固定广告行(替换为空格) * 在同一会话内多次收取(仅一次发送 query按第 2 条是否已为结果决定在 2/3 条间取值,避免重复计费
* 「慢开」返回仍会去掉尾部固定推广行。
* </p> * </p>
*/ */
@Service @Service
@@ -40,8 +41,6 @@ public class OpenPhoneForwardService {
private static final int REPLY_TAKE_NTH_OPEN_BOT = 2; private static final int REPLY_TAKE_NTH_OPEN_BOT = 2;
private static final int REPLY_TAKE_NTH_SLOW_BOT = 3;
/** /**
* QingBao 机器人回复尾部的固定推广行(👉 与正文间可能含 ZWJ U+200D整段替换为空格。 * QingBao 机器人回复尾部的固定推广行(👉 与正文间可能含 ZWJ U+200D整段替换为空格。
*/ */
@@ -121,9 +120,12 @@ public class OpenPhoneForwardService {
body.put("text", phone); body.put("text", phone);
body.put("bot", bot); body.put("bot", bot);
if (waitReply) { if (waitReply) {
int nth = replyTakeNthForBot(bot);
body.put("wait_reply", true); body.put("wait_reply", true);
body.put("reply_take_nth", nth); if (BOT_SLOW_OPEN.equals(bot)) {
body.put("reply_adaptive_skip_middle_ad", true);
} else {
body.put("reply_take_nth", REPLY_TAKE_NTH_OPEN_BOT);
}
} }
byte[] bytes = body.toJSONString().getBytes(StandardCharsets.UTF_8); byte[] bytes = body.toJSONString().getBytes(StandardCharsets.UTF_8);
@@ -169,13 +171,6 @@ public class OpenPhoneForwardService {
} }
} }
private static int replyTakeNthForBot(String bot) {
if (BOT_SLOW_OPEN.equals(bot)) {
return REPLY_TAKE_NTH_SLOW_BOT;
}
return REPLY_TAKE_NTH_OPEN_BOT;
}
/** 将固定广告段替换为空格后 trim。 */ /** 将固定广告段替换为空格后 trim。 */
private static String filterQingBaoAdLines(String reply) { private static String filterQingBaoAdLines(String reply) {
String s = reply; String s = reply;