mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-27 16:04:21 +00:00
fix: 启动后未进行对话时,!list会 越界异常
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}\n"
|
content += f"{index} {time_str}: {conv.messages[0].content 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}"
|
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 '无内容'}"
|
||||||
|
|
||||||
yield entities.CommandReturn(text=f"第 {page + 1} 页 (时间倒序):\n{content}")
|
yield entities.CommandReturn(text=f"第 {page + 1} 页 (时间倒序):\n{content}")
|
||||||
|
|||||||
Reference in New Issue
Block a user