mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
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:
@@ -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[] => {
|
||||
|
Reference in New Issue
Block a user