perf: collection created response (#1947)

* perf: collection created response

* update openapi doc

* remove default collection

* perf: chat ui

* fix: system prompt concat

* perf: published check

* perf: update app
This commit is contained in:
Archer
2024-07-05 10:27:38 +08:00
committed by GitHub
parent 8a7bd689ae
commit 88d10451c9
26 changed files with 160 additions and 165 deletions

View File

@@ -13,24 +13,24 @@ export async function getChatItems({
chatId?: string;
limit?: number;
field: string;
}): Promise<{ history: ChatItemType[] }> {
}): Promise<{ histories: ChatItemType[] }> {
if (!chatId) {
return { history: [] };
return { histories: [] };
}
const history = await MongoChatItem.find({ appId, chatId }, field)
const histories = await MongoChatItem.find({ appId, chatId }, field)
.sort({ _id: -1 })
.limit(limit)
.lean();
history.reverse();
histories.reverse();
history.forEach((item) => {
histories.forEach((item) => {
// @ts-ignore
item.value = adaptStringValue(item.value);
});
return { history };
return { histories };
}
/* 临时适配旧的对话记录 */
export const adaptStringValue = (value: any): ChatItemValueItemType[] => {