diff --git a/web/service/log.ts b/web/service/log.ts index f54e93630f..cd7f0d9b45 100644 --- a/web/service/log.ts +++ b/web/service/log.ts @@ -1,4 +1,3 @@ -import type { Fetcher } from 'swr' import { get, post } from './base' import type { AgentLogDetailRequest, @@ -22,59 +21,33 @@ import type { } from '@/models/log' import type { NodeTracingListResponse } from '@/types/workflow' -export const fetchConversationList: Fetcher }> = ({ appId, params }) => { - return get(`/console/api/apps/${appId}/messages`, params) -} +export const fetchConversationList = ({ appId, params }: { name: string; appId: string; params?: Record }): Promise => get(`/console/api/apps/${appId}/messages`, params) // (Text Generation Application) Session List -export const fetchCompletionConversations: Fetcher = ({ url, params }) => { - return get(url, { params }) -} +export const fetchCompletionConversations = ({ url, params }: { url: string; params?: CompletionConversationsRequest }): Promise => get(url, { params }) // (Text Generation Application) Session Detail -export const fetchCompletionConversationDetail: Fetcher = ({ url }) => { - return get(url, {}) -} +export const fetchCompletionConversationDetail = ({ url }: { url: string }): Promise => get(url, {}) // (Chat Application) Session List -export const fetchChatConversations: Fetcher = ({ url, params }) => { - return get(url, { params }) -} +export const fetchChatConversations = ({ url, params }: { url: string; params?: ChatConversationsRequest }): Promise => get(url, { params }) // (Chat Application) Session Detail -export const fetchChatConversationDetail: Fetcher = ({ url }) => { - return get(url, {}) -} +export const fetchChatConversationDetail = ({ url }: { url: string }): Promise => get(url, {}) // (Chat Application) Message list in one session -export const fetchChatMessages: Fetcher = ({ url, params }) => { - return get(url, { params }) -} +export const fetchChatMessages = ({ url, params }: { url: string; params: ChatMessagesRequest }): Promise => get(url, { params }) -export const updateLogMessageFeedbacks: Fetcher = ({ url, body }) => { - return post(url, { body }) -} +export const updateLogMessageFeedbacks = ({ url, body }: { url: string; body: LogMessageFeedbacksRequest }): Promise => post(url, { body }) -export const updateLogMessageAnnotations: Fetcher = ({ url, body }) => { - return post(url, { body }) -} +export const updateLogMessageAnnotations = ({ url, body }: { url: string; body: LogMessageAnnotationsRequest }): Promise => post(url, { body }) -export const fetchAnnotationsCount: Fetcher = ({ url }) => { - return get(url) -} +export const fetchAnnotationsCount = ({ url }: { url: string }): Promise => get(url) -export const fetchWorkflowLogs: Fetcher }> = ({ url, params }) => { - return get(url, { params }) -} +export const fetchWorkflowLogs = ({ url, params }: { url: string; params: Record }): Promise => get(url, { params }) -export const fetchRunDetail = (url: string) => { - return get(url) -} +export const fetchRunDetail = (url: string): Promise => get(url) -export const fetchTracingList: Fetcher = ({ url }) => { - return get(url) -} +export const fetchTracingList = ({ url }: { url: string }): Promise => get(url) -export const fetchAgentLogDetail = ({ appID, params }: { appID: string; params: AgentLogDetailRequest }) => { - return get(`/apps/${appID}/agent/logs`, { params }) -} +export const fetchAgentLogDetail = ({ appID, params }: { appID: string; params: AgentLogDetailRequest }): Promise => get(`/apps/${appID}/agent/logs`, { params })