This commit is contained in:
SengokuCola
2025-08-13 23:17:36 +08:00
3 changed files with 8 additions and 8 deletions

View File

@@ -193,7 +193,7 @@ class HeartFChatting:
+ (f"\n详情: {'; '.join(timer_strings)}" if timer_strings else "") + (f"\n详情: {'; '.join(timer_strings)}" if timer_strings else "")
) )
def _determine_form_type(self) -> str: def _determine_form_type(self) -> None:
"""判断使用哪种形式的no_reply""" """判断使用哪种形式的no_reply"""
# 如果连续no_reply次数少于3次使用waiting形式 # 如果连续no_reply次数少于3次使用waiting形式
if self.no_reply_consecutive <= 3: if self.no_reply_consecutive <= 3:

View File

@@ -3,7 +3,7 @@ import time
import random import random
import hashlib import hashlib
from typing import List, Dict, Optional, Any from typing import List, Dict, Optional, Any, Tuple
from json_repair import repair_json from json_repair import repair_json
from src.llm_models.utils_model import LLMRequest from src.llm_models.utils_model import LLMRequest
@@ -197,7 +197,7 @@ class ExpressionSelector:
chat_info: str, chat_info: str,
max_num: int = 10, max_num: int = 10,
target_message: Optional[str] = None, target_message: Optional[str] = None,
) -> List[Dict[str, Any]]: ) -> Tuple[List[Dict[str, Any]], List[int]]:
# sourcery skip: inline-variable, list-comprehension # sourcery skip: inline-variable, list-comprehension
"""使用LLM选择适合的表达方式""" """使用LLM选择适合的表达方式"""
@@ -214,8 +214,8 @@ class ExpressionSelector:
return [], [] return [], []
# 2. 构建所有表达方式的索引和情境列表 # 2. 构建所有表达方式的索引和情境列表
all_expressions = [] all_expressions: List[Dict[str, Any]] = []
all_situations = [] all_situations: List[str] = []
# 添加style表达方式 # 添加style表达方式
for expr in style_exprs: for expr in style_exprs:
@@ -277,7 +277,7 @@ class ExpressionSelector:
selected_indices = result["selected_situations"] selected_indices = result["selected_situations"]
# 根据索引获取完整的表达方式 # 根据索引获取完整的表达方式
valid_expressions = [] valid_expressions: List[Dict[str, Any]] = []
selected_ids = [] selected_ids = []
for idx in selected_indices: for idx in selected_indices:
if isinstance(idx, int) and 1 <= idx <= len(all_expressions): if isinstance(idx, int) and 1 <= idx <= len(all_expressions):
@@ -290,7 +290,7 @@ class ExpressionSelector:
self.update_expressions_count_batch(valid_expressions, 0.006) self.update_expressions_count_batch(valid_expressions, 0.006)
# logger.info(f"LLM从{len(all_expressions)}个情境中选择了{len(valid_expressions)}个") # logger.info(f"LLM从{len(all_expressions)}个情境中选择了{len(valid_expressions)}个")
return valid_expressions , selected_ids return valid_expressions, selected_ids
except Exception as e: except Exception as e:
logger.error(f"LLM处理表达方式选择时出错: {e}") logger.error(f"LLM处理表达方式选择时出错: {e}")

View File

@@ -170,7 +170,7 @@ class ChatBot:
# 处理消息内容 # 处理消息内容
await message.process() await message.process()
person = Person.register_person(platform=message.message_info.platform, user_id=message.message_info.user_info.user_id,nickname=user_info.user_nickname) _ = Person.register_person(platform=message.message_info.platform, user_id=message.message_info.user_info.user_id,nickname=user_info.user_nickname) # type: ignore
await self.s4u_message_processor.process_message(message) await self.s4u_message_processor.process_message(message)