perf: 细节优化

This commit is contained in:
RockChinQ 2024-05-16 21:02:59 +08:00
parent 91e23b8c11
commit a3706bfe21
4 changed files with 3 additions and 20 deletions

View File

@ -42,7 +42,7 @@ class ListOperator(operator.CommandOperator):
using_conv_index = index
if index >= page * record_per_page and index < (page + 1) * record_per_page:
content += f"{index} {time_str}: {conv.messages[0].content if len(conv.messages) > 0 else '无内容'}\n"
content += f"{index} {time_str}: {conv.messages[0].readable_str() if len(conv.messages) > 0 else '无内容'}\n"
index += 1
if content == '':
@ -51,6 +51,6 @@ class ListOperator(operator.CommandOperator):
if context.session.using_conversation is None:
content += "\n当前处于新会话"
else:
content += f"\n当前会话: {using_conv_index} {context.session.using_conversation.create_time.strftime('%Y-%m-%d %H:%M:%S')}: {context.session.using_conversation.messages[0].content if len(context.session.using_conversation.messages) > 0 else '无内容'}"
content += f"\n当前会话: {using_conv_index} {context.session.using_conversation.create_time.strftime('%Y-%m-%d %H:%M:%S')}: {context.session.using_conversation.messages[0].readable_str() if len(context.session.using_conversation.messages) > 0 else '无内容'}"
yield entities.CommandReturn(text=f"{page + 1} 页 (时间倒序):\n{content}")

View File

@ -31,13 +31,6 @@ class EnableStage(enum.Enum):
"""后处理"""
class AcceptContent(enum.Enum):
"""过滤器接受的内容模态"""
TEXT = enum.auto()
IMAGE_URL = enum.auto()
class FilterResult(pydantic.BaseModel):
level: ResultLevel
"""结果等级

View File

@ -57,16 +57,6 @@ class ContentFilter(metaclass=abc.ABCMeta):
entities.EnableStage.PRE,
entities.EnableStage.POST
]
@property
def accept_content(self):
"""本过滤器接受的模态
默认仅接受纯文本
"""
return [
entities.AcceptContent.TEXT
]
async def initialize(self):
"""初始化过滤器

View File

@ -1,6 +1,6 @@
{
"enable-chat": true,
"enable-vision": false,
"enable-vision": true,
"keys": {
"openai": [
"sk-1234567890"