mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-17 03:04:20 +00:00
perf: 细节优化
This commit is contained in:
@@ -42,7 +42,7 @@ class ListOperator(operator.CommandOperator):
|
|||||||
using_conv_index = index
|
using_conv_index = index
|
||||||
|
|
||||||
if index >= page * record_per_page and index < (page + 1) * record_per_page:
|
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
|
index += 1
|
||||||
|
|
||||||
if content == '':
|
if content == '':
|
||||||
@@ -51,6 +51,6 @@ class ListOperator(operator.CommandOperator):
|
|||||||
if context.session.using_conversation is None:
|
if context.session.using_conversation is None:
|
||||||
content += "\n当前处于新会话"
|
content += "\n当前处于新会话"
|
||||||
else:
|
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}")
|
yield entities.CommandReturn(text=f"第 {page + 1} 页 (时间倒序):\n{content}")
|
||||||
|
|||||||
@@ -31,13 +31,6 @@ class EnableStage(enum.Enum):
|
|||||||
"""后处理"""
|
"""后处理"""
|
||||||
|
|
||||||
|
|
||||||
class AcceptContent(enum.Enum):
|
|
||||||
"""过滤器接受的内容模态"""
|
|
||||||
|
|
||||||
TEXT = enum.auto()
|
|
||||||
|
|
||||||
IMAGE_URL = enum.auto()
|
|
||||||
|
|
||||||
class FilterResult(pydantic.BaseModel):
|
class FilterResult(pydantic.BaseModel):
|
||||||
level: ResultLevel
|
level: ResultLevel
|
||||||
"""结果等级
|
"""结果等级
|
||||||
|
|||||||
@@ -57,16 +57,6 @@ class ContentFilter(metaclass=abc.ABCMeta):
|
|||||||
entities.EnableStage.PRE,
|
entities.EnableStage.PRE,
|
||||||
entities.EnableStage.POST
|
entities.EnableStage.POST
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
|
||||||
def accept_content(self):
|
|
||||||
"""本过滤器接受的模态
|
|
||||||
|
|
||||||
默认仅接受纯文本
|
|
||||||
"""
|
|
||||||
return [
|
|
||||||
entities.AcceptContent.TEXT
|
|
||||||
]
|
|
||||||
|
|
||||||
async def initialize(self):
|
async def initialize(self):
|
||||||
"""初始化过滤器
|
"""初始化过滤器
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"enable-chat": true,
|
"enable-chat": true,
|
||||||
"enable-vision": false,
|
"enable-vision": true,
|
||||||
"keys": {
|
"keys": {
|
||||||
"openai": [
|
"openai": [
|
||||||
"sk-1234567890"
|
"sk-1234567890"
|
||||||
|
|||||||
Reference in New Issue
Block a user