fix bugs related to system prompt and titles

This commit is contained in:
Cogent Apps
2023-03-07 11:26:20 -08:00
committed by GitHub
parent 0f52447203
commit 2b99a7299c
2 changed files with 10 additions and 2 deletions

View File

@@ -237,13 +237,20 @@ export class Search {
const output: any[] = [];
for (const item of searchResults) {
const chatID = item.id;
const chat = this.chats.get(chatID);
let chat = this.chats.get(chatID);
if (!chat) {
continue;
}
chat = { ...chat };
let description = chat.messages?.first?.content || '';
description = ellipsize(description, 400);
if (!chat.title) {
chat.title = ellipsize(description, 100);
}
if (!chat.title || !description) {
continue;
}