feat: 优化图片描述提示词,简化表情包描述逻辑,调整额外信息要求

pull/541/head
XBC_D2O 2025-03-11 22:19:10 +08:00
parent b2405a47be
commit 5d1915cab5
3 changed files with 6 additions and 6 deletions

View File

@ -201,7 +201,7 @@ class CQCode:
async def get_image_description(self, image_base64: str) -> str: async def get_image_description(self, image_base64: str) -> str:
"""调用AI接口获取普通图片描述""" """调用AI接口获取普通图片描述"""
try: try:
prompt = "请用中文描述这张图片的内容。如果有文字请把文字都描述出来。并尝试猜测这个图片的含义。最多200个字可以使用二次元词汇如:猫娘、萝莉" prompt = "请用中文描述这张图片的内容。如果有文字请把文字都描述出来。并尝试猜测这个图片的含义。最多200个字可以使用二次元词汇"
# description, _ = self._llm.generate_response_for_image_sync(prompt, image_base64) # description, _ = self._llm.generate_response_for_image_sync(prompt, image_base64)
description, _ = await self._llm.generate_response_for_image(prompt, image_base64) description, _ = await self._llm.generate_response_for_image(prompt, image_base64)
return f"[图片:{description}]" return f"[图片:{description}]"

View File

@ -177,7 +177,7 @@ class EmojiManager:
async def _get_emoji_discription(self, image_base64: str) -> str: async def _get_emoji_discription(self, image_base64: str) -> str:
"""获取表情包的标签""" """获取表情包的标签"""
try: try:
prompt = '这是一个表情包,使用中文简洁的描述一下表情包的内容、上面的文字和表情包所表达的情感,可以使用二次元词汇如:猫娘、萝莉' prompt = '这是一个表情包,使用中文简洁的描述一下表情包的内容、上面的文字和表情包所表达的情感,可以使用二次元词汇'
content, _ = await self.vlm.generate_response_for_image(prompt, image_base64) content, _ = await self.vlm.generate_response_for_image(prompt, image_base64)
logger.debug(f"输出描述: {content}") logger.debug(f"输出描述: {content}")

View File

@ -156,7 +156,7 @@ class PromptBuilder:
# prompt_ger += '你喜欢用文言文' # prompt_ger += '你喜欢用文言文'
# 额外信息要求 # 额外信息要求
extra_info = '''尤其注意在没明确提到时不要过多提及自身的背景, 不要直接回复别人发的表情包,记住不要输出多余内容(包括前后缀,冒号和引号,括号,表情等),只需要输出回复内容就好,不要输出其他任何内容''' extra_info = '''尤其注意在没明确提到时不要过多提及自身的背景, 回答平淡一点,不要直接回复别人发的表情包,记住不要输出多余内容(包括前后缀,冒号和引号,括号,表情等),只需要输出回复内容就好,不要输出其他任何内容'''
# 合并prompt # 合并prompt
prompt = "" prompt = ""
@ -185,9 +185,9 @@ class PromptBuilder:
def _build_initiative_prompt_select(self, group_id, probability_1=0.8, probability_2=0.1): def _build_initiative_prompt_select(self, group_id, probability_1=0.8, probability_2=0.1):
current_date = time.strftime("%Y-%m-%d", time.localtime()) current_date = time.strftime("%Y-%m-%d", time.localtime())
current_time = time.strftime("%H:%M:%S", time.localtime()) current_time = time.strftime("%H:%M:%S", time.localtime())
bot_schedule_now_time, bot_schedule_now_activity = bot_schedule.get_current_task() #bot_schedule_now_time, bot_schedule_now_activity = bot_schedule.get_current_task()
prompt_date = f'''今天是{current_date},现在是{current_time},你今天的日程是:\n{bot_schedule.today_schedule}\n你现在正在{bot_schedule_now_activity}\n''' prompt_date = f'''今天是{current_date},现在是{current_time}\n'''
#,你今天的日程是:\n{bot_schedule.today_schedule}\n你现在正在{bot_schedule_now_activity}
chat_talking_prompt = '' chat_talking_prompt = ''
if group_id: if group_id:
chat_talking_prompt = get_recent_group_detailed_plain_text(self.db, group_id, chat_talking_prompt = get_recent_group_detailed_plain_text(self.db, group_id,