import type { Fetcher } from 'swr' import { get, post } from './base' import type { AgentLogDetailRequest, AgentLogDetailResponse, AnnotationsCountResponse, ChatConversationFullDetailResponse, ChatConversationsRequest, ChatConversationsResponse, ChatMessagesRequest, ChatMessagesResponse, CompletionConversationFullDetailResponse, CompletionConversationsRequest, CompletionConversationsResponse, ConversationListResponse, LogMessageAnnotationsRequest, LogMessageAnnotationsResponse, LogMessageFeedbacksRequest, LogMessageFeedbacksResponse, WorkflowLogsRequest, WorkflowLogsResponse, WorkflowRunDetailResponse, } from '@/models/log' import type { NodeTracingListResponse } from '@/types/workflow' export const fetchConversationList: Fetcher }> = ({ appId, params }) => { return get(`/console/api/apps/${appId}/messages`, params) } // (Text Generation Application) Session List export const fetchCompletionConversations: Fetcher = ({ url, params }) => { return get(url, { params }) } // (Text Generation Application) Session Detail export const fetchCompletionConversationDetail: Fetcher = ({ url }) => { return get(url, {}) } // (Chat Application) Session List export const fetchChatConversations: Fetcher = ({ url, params }) => { return get(url, { params }) } // (Chat Application) Session Detail export const fetchChatConversationDetail: Fetcher = ({ url }) => { return get(url, {}) } // (Chat Application) Message list in one session export const fetchChatMessages: Fetcher = ({ url, params }) => { return get(url, { params }) } export const updateLogMessageFeedbacks: Fetcher = ({ url, body }) => { return post(url, { body }) } export const updateLogMessageAnnotations: Fetcher = ({ url, body }) => { return post(url, { body }) } export const fetchAnnotationsCount: Fetcher = ({ url }) => { return get(url) } export const fetchWorkflowLogs: Fetcher = ({ url, params }) => { return get(url, { params }) } export const fetchRunDetail = ({ appID, runID }: { appID: string; runID: string }) => { return get(`/apps/${appID}/workflow-runs/${runID}`) } export const fetchTracingList: Fetcher = ({ url }) => { return get(url) } export const fetchAgentLogDetail = ({ appID, params }: { appID: string; params: AgentLogDetailRequest }) => { return get(`/apps/${appID}/agent/logs`, { params }) }