feat: app detail

This commit is contained in:
archer
2023-07-13 15:07:13 +08:00
parent 6c72c20317
commit b4d46ff34d
47 changed files with 1088 additions and 1091 deletions

View File

@@ -3,6 +3,7 @@ import type { AppSchema } from '@/types/mongoSchema';
import type { AppListItemType, AppUpdateParams } from '@/types/app';
import { RequestPaging } from '../types/index';
import type { Props as CreateAppProps } from '@/pages/api/app/create';
import { addDays } from 'date-fns';
/**
* 获取模型列表
@@ -42,3 +43,11 @@ export const getShareModelList = (data: { searchText?: string } & RequestPaging)
*/
export const triggerModelCollection = (appId: string) =>
POST<number>(`/app/share/collection?appId=${appId}`);
// ====================== data
export const getTokenUsage = (data: { appId: string }) =>
POST<{ tokenLen: number; date: Date }[]>(`/app/data/tokenUsage`, {
...data,
start: addDays(new Date(), -7),
end: new Date()
});

View File

@@ -28,15 +28,15 @@ export const delChatHistoryById = (id: string) => GET(`/chat/removeHistory?id=${
/**
* get history quotes
*/
export const getHistoryQuote = (params: { chatId: string; historyId: string }) =>
export const getHistoryQuote = (params: { historyId: string; contentId: string }) =>
GET<(QuoteItemType & { _id: string })[]>(`/chat/history/getHistoryQuote`, params);
/**
* update history quote status
*/
export const updateHistoryQuote = (params: {
chatId: string;
historyId: string;
contentId: string;
quoteId: string;
sourceText: string;
}) => GET(`/chat/history/updateHistoryQuote`, params);