fix(chat): improve history + polish SwiftUI panel
This commit is contained in:
@@ -458,6 +458,7 @@ export const CronRunLogEntrySchema = Type.Object(
|
||||
export const ChatHistoryParamsSchema = Type.Object(
|
||||
{
|
||||
sessionKey: NonEmptyString,
|
||||
limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 500 })),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
@@ -793,13 +793,19 @@ export async function startGatewayServer(
|
||||
},
|
||||
};
|
||||
}
|
||||
const { sessionKey } = params as { sessionKey: string };
|
||||
const { sessionKey, limit } = params as {
|
||||
sessionKey: string;
|
||||
limit?: number;
|
||||
};
|
||||
const { storePath, entry } = loadSessionEntry(sessionKey);
|
||||
const sessionId = entry?.sessionId;
|
||||
const messages =
|
||||
const rawMessages =
|
||||
sessionId && storePath
|
||||
? readSessionMessages(sessionId, storePath)
|
||||
: [];
|
||||
const max = typeof limit === "number" ? limit : 200;
|
||||
const messages =
|
||||
rawMessages.length > max ? rawMessages.slice(-max) : rawMessages;
|
||||
const thinkingLevel =
|
||||
entry?.thinkingLevel ??
|
||||
loadConfig().inbound?.reply?.thinkingDefault ??
|
||||
|
||||
Reference in New Issue
Block a user