mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 19:50:09 +00:00
♻️ refactor: refactor trace type (#8699)
* refactor trace type * refactor lobechat type * refactor types
This commit is contained in:
@@ -2,19 +2,11 @@
|
||||
"name": "@lobechat/types",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"exports": {
|
||||
"./*": {
|
||||
"types": [
|
||||
"./src/*.ts",
|
||||
"./src/*/index.ts"
|
||||
],
|
||||
"default": [
|
||||
"./src/*.ts",
|
||||
"./src/*/index.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"main": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@lobehub/chat-plugin-sdk": "^1.32.4"
|
||||
"@lobechat/web-crawler": "workspace:*",
|
||||
"@lobehub/chat-plugin-sdk": "^1.32.4",
|
||||
"type-fest": "^4.41.0",
|
||||
"zod": "^3.25.76"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { AiModelForSelect, EnabledAiModel, ModelSearchImplementType } from '@/types/aiModel';
|
||||
import { ResponseAnimation } from '@/types/llm';
|
||||
import { AiModelForSelect, EnabledAiModel, ModelSearchImplementType } from './aiModel';
|
||||
import { ResponseAnimation } from './llm';
|
||||
|
||||
export const AiProviderSourceEnum = {
|
||||
Builtin: 'builtin',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LobeAgentConfig } from '@/types/agent';
|
||||
import { LobeAgentConfig } from './agent';
|
||||
import {
|
||||
ChatMessageError,
|
||||
ChatPluginPayload,
|
||||
@@ -6,9 +6,9 @@ import {
|
||||
ChatToolPayload,
|
||||
ChatTranslate,
|
||||
MessageRoleType,
|
||||
} from '@/types/message';
|
||||
import { MetaData } from '@/types/meta';
|
||||
import { SessionGroupId } from '@/types/session';
|
||||
} from './message';
|
||||
import { MetaData } from './meta';
|
||||
import { SessionGroupId } from './session';
|
||||
|
||||
export interface ImportSession {
|
||||
config: LobeAgentConfig;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './artifact';
|
||||
export * from './fetch';
|
||||
export * from './trace';
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
import { AiModelType, ChatModelPricing } from '@/types/aiModel';
|
||||
import { AiProviderSettings } from '@/types/aiProvider';
|
||||
import { AiModelType, ChatModelPricing } from './aiModel';
|
||||
import { AiProviderSettings } from './aiProvider';
|
||||
|
||||
export type ModelPriceCurrency = 'CNY' | 'USD';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { ChatSemanticSearchChunk } from '@/types/chunk';
|
||||
import { ChatSemanticSearchChunk } from './chunk';
|
||||
|
||||
export const SemanticSearchSchema = z.object({
|
||||
fileIds: z.array(z.string()).optional(),
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
|
||||
import { IFeatureFlags } from '@/config/featureFlags';
|
||||
import { ChatModelCard } from '@/types/llm';
|
||||
import {
|
||||
GlobalLLMProviderKey,
|
||||
UserDefaultAgent,
|
||||
UserSystemAgentConfig,
|
||||
} from '@/types/user/settings';
|
||||
|
||||
import { ChatModelCard } from './llm';
|
||||
import { GlobalLLMProviderKey, UserDefaultAgent, UserSystemAgentConfig } from './user/settings';
|
||||
|
||||
export interface ServerModelProviderConfig {
|
||||
enabled?: boolean;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
export interface ShareGPTConversation {
|
||||
avatarUrl?: string | null;
|
||||
items: Array<{
|
||||
from: 'human' | 'gpt';
|
||||
value: any;
|
||||
}>;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TraceEventType } from '@/const/trace';
|
||||
import { TraceEventType, TraceNameMap } from './enum';
|
||||
|
||||
export interface TraceEventBasePayload {
|
||||
content: string;
|
||||
@@ -29,3 +29,26 @@ export type TraceEventPayloads =
|
||||
| TraceEventModifyMessage
|
||||
| TraceEventDeleteAndRegenerateMessage
|
||||
| TraceEventRegenerateMessage;
|
||||
|
||||
export interface TracePayload {
|
||||
/**
|
||||
* if user allow to trace
|
||||
*/
|
||||
enabled?: boolean;
|
||||
observationId?: string;
|
||||
/**
|
||||
* chat session: agentId or groupId
|
||||
*/
|
||||
sessionId?: string;
|
||||
tags?: string[];
|
||||
/**
|
||||
* chat topicId
|
||||
*/
|
||||
topicId?: string;
|
||||
traceId?: string;
|
||||
traceName?: TraceNameMap;
|
||||
/**
|
||||
* user uuid
|
||||
*/
|
||||
userId?: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
export enum TraceNameMap {
|
||||
ConnectivityChecker = 'Connectivity Checker',
|
||||
Conversation = 'Conversation',
|
||||
EmojiPicker = 'Emoji Picker',
|
||||
FetchPluginAPI = 'Fetch Plugin API',
|
||||
LanguageDetect = 'Language Detect',
|
||||
SearchIntentRecognition = 'Search Intent Recognition',
|
||||
SummaryAgentDescription = 'Summary Agent Description',
|
||||
SummaryAgentTags = 'Summary Agent Tags',
|
||||
SummaryAgentTitle = 'Summary Agent Title',
|
||||
SummaryHistoryMessages = 'Summary History Messages',
|
||||
SummaryTopicTitle = 'Summary Topic Title',
|
||||
Translator = 'Translator',
|
||||
}
|
||||
|
||||
export enum TraceEventType {
|
||||
CopyMessage = 'Copy Message',
|
||||
DeleteAndRegenerateMessage = 'Delete And Regenerate Message',
|
||||
ModifyMessage = 'Modify Message',
|
||||
RegenerateMessage = 'Regenerate Message',
|
||||
}
|
||||
|
||||
export enum TraceTopicType {
|
||||
AgentSettings = 'Agent Settings',
|
||||
}
|
||||
|
||||
export enum TraceTagMap {
|
||||
Chat = 'Chat Competition',
|
||||
SystemChain = 'System Chain',
|
||||
ToolCalling = 'Tool Calling',
|
||||
ToolsCalling = 'Tools Calling',
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
export * from './action';
|
||||
export * from './enum';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { Plans } from '@/types/subscription';
|
||||
import { TopicDisplayMode } from '@/types/topic';
|
||||
import { UserSettings } from '@/types/user/settings';
|
||||
import { Plans } from '../subscription';
|
||||
import { TopicDisplayMode } from '../topic';
|
||||
import { UserSettings } from '../user/settings';
|
||||
|
||||
export interface LobeUser {
|
||||
avatar?: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
|
||||
import { getAppConfig } from '@/envs/app';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
import OpenAI, { ClientOptions } from 'openai';
|
||||
import urlJoin from 'url-join';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
import OpenAI from 'openai';
|
||||
|
||||
import { getLLMConfig } from '@/config/llm';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType, ErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType, ErrorType } from '@lobechat/types';
|
||||
import OpenAI from 'openai';
|
||||
|
||||
import { getOpenAIAuthFromRequest } from '@/const/fetch';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { AgentRuntimeError } from '@/libs/model-runtime';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AuthObject } from '@clerk/backend';
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
import { NextRequest } from 'next/server';
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type AuthObject } from '@clerk/backend';
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
|
||||
import { enableClerk, enableNextAuth } from '@/const/auth';
|
||||
import { getAppConfig } from '@/envs/app';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @vitest-environment node
|
||||
import { getAuth } from '@clerk/nextjs/server';
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { checkAuthMethod } from '@/app/(backend)/middleware/auth/utils';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
|
||||
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
|
||||
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
||||
import { ChatCompletionErrorPayload, PullModelParams } from '@/libs/model-runtime';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ChatErrorType, ErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType, ErrorType , TraceNameMap } from '@lobechat/types';
|
||||
import { PluginRequestPayload } from '@lobehub/chat-plugin-sdk';
|
||||
import { createGatewayOnEdgeRuntime } from '@lobehub/chat-plugins-gateway';
|
||||
|
||||
import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED, enableNextAuth } from '@/const/auth';
|
||||
import { LOBE_CHAT_TRACE_ID, TraceNameMap } from '@/const/trace';
|
||||
import { LOBE_CHAT_TRACE_ID } from '@/const/trace';
|
||||
import { getAppConfig } from '@/envs/app';
|
||||
import { AgentRuntimeError } from '@/libs/model-runtime';
|
||||
import { TraceClient } from '@/libs/traces';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { TraceEventType } from '@lobechat/types';
|
||||
import { after } from 'next/server';
|
||||
|
||||
import { TraceEventType } from '@/const/trace';
|
||||
import { TraceClient } from '@/libs/traces';
|
||||
import { TraceEventBasePayload, TraceEventPayloads } from '@/types/trace';
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
'use client';
|
||||
|
||||
import { CheckCircleFilled } from '@ant-design/icons';
|
||||
import { TraceNameMap } from '@lobechat/types';
|
||||
import { Alert, Button, Highlighter } from '@lobehub/ui';
|
||||
import { useTheme } from 'antd-style';
|
||||
import { memo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { TraceNameMap } from '@/const/trace';
|
||||
import { useIsMobile } from '@/hooks/useIsMobile';
|
||||
import { useProviderName } from '@/hooks/useProviderName';
|
||||
import { chatService } from '@/services/chat';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { CheckCircleFilled } from '@ant-design/icons';
|
||||
import { TraceNameMap } from '@lobechat/types';
|
||||
import { ModelIcon } from '@lobehub/icons';
|
||||
import { Alert, Button, Highlighter, Icon, Select } from '@lobehub/ui';
|
||||
import { useTheme } from 'antd-style';
|
||||
@@ -9,7 +10,6 @@ import { ReactNode, memo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { TraceNameMap } from '@/const/trace';
|
||||
import { useProviderName } from '@/hooks/useProviderName';
|
||||
import { chatService } from '@/services/chat';
|
||||
import { aiModelSelectors, aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
||||
|
||||
+2
-33
@@ -1,40 +1,9 @@
|
||||
import { TraceNameMap } from '@/types/trace';
|
||||
|
||||
export const LOBE_CHAT_TRACE_HEADER = 'X-lobe-trace';
|
||||
export const LOBE_CHAT_TRACE_ID = 'X-lobe-chat-trace-id';
|
||||
export const LOBE_CHAT_OBSERVATION_ID = 'X-lobe-observation-id';
|
||||
|
||||
export enum TraceNameMap {
|
||||
ConnectivityChecker = 'Connectivity Checker',
|
||||
Conversation = 'Conversation',
|
||||
EmojiPicker = 'Emoji Picker',
|
||||
FetchPluginAPI = 'Fetch Plugin API',
|
||||
LanguageDetect = 'Language Detect',
|
||||
SearchIntentRecognition = 'Search Intent Recognition',
|
||||
SummaryAgentDescription = 'Summary Agent Description',
|
||||
SummaryAgentTags = 'Summary Agent Tags',
|
||||
SummaryAgentTitle = 'Summary Agent Title',
|
||||
SummaryHistoryMessages = 'Summary History Messages',
|
||||
SummaryTopicTitle = 'Summary Topic Title',
|
||||
Translator = 'Translator',
|
||||
}
|
||||
|
||||
export enum TraceEventType {
|
||||
CopyMessage = 'Copy Message',
|
||||
DeleteAndRegenerateMessage = 'Delete And Regenerate Message',
|
||||
ModifyMessage = 'Modify Message',
|
||||
RegenerateMessage = 'Regenerate Message',
|
||||
}
|
||||
|
||||
export enum TraceTopicType {
|
||||
AgentSettings = 'Agent Settings',
|
||||
}
|
||||
|
||||
export enum TraceTagMap {
|
||||
Chat = 'Chat Competition',
|
||||
SystemChain = 'System Chain',
|
||||
ToolCalling = 'Tool Calling',
|
||||
ToolsCalling = 'Tools Calling',
|
||||
}
|
||||
|
||||
export interface TracePayload {
|
||||
/**
|
||||
* if user allow to trace
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import { TraceNameMap, TracePayload, TraceTopicType } from '@lobechat/types';
|
||||
import { getSingletonAnalyticsOptional } from '@lobehub/analytics';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import { StateCreator } from 'zustand/vanilla';
|
||||
|
||||
import { chainPickEmoji } from '@/chains/pickEmoji';
|
||||
import { chainSummaryAgentName } from '@/chains/summaryAgentName';
|
||||
import { chainSummaryDescription } from '@/chains/summaryDescription';
|
||||
import { chainSummaryTags } from '@/chains/summaryTags';
|
||||
import { TraceNameMap, TracePayload, TraceTopicType } from '@/const/trace';
|
||||
import { chatService } from '@/services/chat';
|
||||
import { useUserStore } from '@/store/user';
|
||||
import { systemAgentSelectors } from '@/store/user/slices/settings/selectors';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType, ErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType, ErrorType } from '@lobechat/types';
|
||||
import { IPluginErrorType } from '@lobehub/chat-plugin-sdk';
|
||||
import type { AlertProps } from '@lobehub/ui';
|
||||
import { Skeleton } from 'antd';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ArtifactType } from '@lobechat/types/artifact';
|
||||
import { ArtifactType } from '@lobechat/types';
|
||||
import { ActionIcon, Icon, Segmented, Text } from '@lobehub/ui';
|
||||
import { ConfigProvider } from 'antd';
|
||||
import { cx } from 'antd-style';
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// @vitest-environment node
|
||||
import { TraceNameMap } from '@lobechat/types';
|
||||
import { Langfuse } from 'langfuse';
|
||||
import { LangfuseGenerationClient, LangfuseTraceClient } from 'langfuse-core';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import * as langfuseCfg from '@/config/langfuse';
|
||||
import { ClientSecretPayload } from '@/const/auth';
|
||||
import { TraceNameMap } from '@/const/trace';
|
||||
import { ChatStreamPayload, LobeOpenAI, ModelProvider, ModelRuntime } from '@/libs/model-runtime';
|
||||
import { providerRuntimeMap } from '@/libs/model-runtime/runtimeMap';
|
||||
import { CreateImagePayload } from '@/libs/model-runtime/types/image';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { TracePayload } from '@lobechat/types';
|
||||
import { ClientOptions } from 'openai';
|
||||
|
||||
import type { TracePayload } from '@/const/trace';
|
||||
|
||||
import { LobeRuntimeAI } from './BaseAI';
|
||||
import { LobeBedrockAIParams } from './bedrock';
|
||||
import { LobeCloudflareParams } from './cloudflare';
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { TraceEventType } from '@lobechat/types';
|
||||
import { diffChars } from 'diff';
|
||||
import { LangfuseTraceClient } from 'langfuse-core';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { TraceEventType } from '@/const/trace';
|
||||
|
||||
import { EventScore, TraceEventClient } from './event';
|
||||
|
||||
describe('TraceEventClient', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TraceEventType } from '@lobechat/types';
|
||||
import { diffChars } from 'diff';
|
||||
import { LangfuseTraceClient } from 'langfuse-core';
|
||||
|
||||
import { TraceEventType } from '@/const/trace';
|
||||
import {
|
||||
TraceEventBasePayload,
|
||||
TraceEventCopyMessage,
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import { TracePayload, TraceTagMap } from '@lobechat/types';
|
||||
import { after } from 'next/server';
|
||||
|
||||
import { INBOX_SESSION_ID } from '@/const/session';
|
||||
import {
|
||||
LOBE_CHAT_OBSERVATION_ID,
|
||||
LOBE_CHAT_TRACE_ID,
|
||||
TracePayload,
|
||||
TraceTagMap,
|
||||
} from '@/const/trace';
|
||||
import { LOBE_CHAT_OBSERVATION_ID, LOBE_CHAT_TRACE_ID } from '@/const/trace';
|
||||
import { ChatStreamCallbacks, ChatStreamPayload } from '@/libs/model-runtime';
|
||||
import { TraceClient } from '@/libs/traces';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk';
|
||||
import { act } from '@testing-library/react';
|
||||
import { merge } from 'lodash-es';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType , TracePayload, TraceTagMap } from '@lobechat/types';
|
||||
import { PluginRequestPayload, createHeadersWithPluginSettings } from '@lobehub/chat-plugin-sdk';
|
||||
import { produce } from 'immer';
|
||||
import { merge } from 'lodash-es';
|
||||
@@ -7,7 +7,6 @@ import { enableAuth } from '@/const/auth';
|
||||
import { INBOX_GUIDE_SYSTEMROLE } from '@/const/guide';
|
||||
import { INBOX_SESSION_ID } from '@/const/session';
|
||||
import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
|
||||
import { TracePayload, TraceTagMap } from '@/const/trace';
|
||||
import { isDeprecatedEdition, isDesktop, isServerMode } from '@/const/version';
|
||||
import {
|
||||
AgentRuntimeError,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
|
||||
// Disable the auto sort key eslint rule to make the code more logic and readable
|
||||
import { TraceEventType, TraceNameMap } from '@lobechat/types';
|
||||
import { t } from 'i18next';
|
||||
import { produce } from 'immer';
|
||||
import { template } from 'lodash-es';
|
||||
import { StateCreator } from 'zustand/vanilla';
|
||||
|
||||
import { LOADING_FLAT, MESSAGE_CANCEL_FLAT } from '@/const/message';
|
||||
import { TraceEventType, TraceNameMap } from '@/const/trace';
|
||||
import { isDesktop, isServerMode } from '@/const/version';
|
||||
import { knowledgeBaseQAPrompts } from '@/prompts/knowledgeBaseQA';
|
||||
import { chatService } from '@/services/chat';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TraceNameMap } from '@lobechat/types';
|
||||
import { StateCreator } from 'zustand/vanilla';
|
||||
|
||||
import { chainSummaryHistory } from '@/chains/summaryHistory';
|
||||
import { TraceNameMap } from '@/const/trace';
|
||||
import { chatService } from '@/services/chat';
|
||||
import { topicService } from '@/services/topic';
|
||||
import { ChatStore } from '@/store/chat';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { TraceEventType } from '@lobechat/types';
|
||||
import * as lobeUIModules from '@lobehub/ui';
|
||||
import { act, renderHook, waitFor } from '@testing-library/react';
|
||||
import { mutate } from 'swr';
|
||||
import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { TraceEventType } from '@/const/trace';
|
||||
import { messageService } from '@/services/message';
|
||||
import { topicService } from '@/services/topic';
|
||||
import { messageMapKey } from '@/store/chat/utils/messageMapKey';
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
|
||||
// Disable the auto sort key eslint rule to make the code more logic and readable
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType, TraceEventType } from '@lobechat/types';
|
||||
import { copyToClipboard } from '@lobehub/ui';
|
||||
import isEqual from 'fast-deep-equal';
|
||||
import { SWRResponse, mutate } from 'swr';
|
||||
import { StateCreator } from 'zustand/vanilla';
|
||||
|
||||
import { TraceEventType } from '@/const/trace';
|
||||
import { useClientDataSWR } from '@/libs/swr';
|
||||
import { messageService } from '@/services/message';
|
||||
import { topicService } from '@/services/topic';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
import { PluginErrorType } from '@lobehub/chat-plugin-sdk';
|
||||
import isEqual from 'fast-deep-equal';
|
||||
import { t } from 'i18next';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
|
||||
// Note: To make the code more logic and readable, we just disable the auto sort key eslint rule
|
||||
// DON'T REMOVE THE FIRST LINE
|
||||
import { TraceNameMap } from '@lobechat/types';
|
||||
import isEqual from 'fast-deep-equal';
|
||||
import { t } from 'i18next';
|
||||
import useSWR, { SWRResponse, mutate } from 'swr';
|
||||
@@ -9,7 +10,6 @@ import { StateCreator } from 'zustand/vanilla';
|
||||
import { chainSummaryTitle } from '@/chains/summaryTitle';
|
||||
import { message } from '@/components/AntdStaticMethods';
|
||||
import { LOADING_FLAT } from '@/const/message';
|
||||
import { TraceNameMap } from '@/const/trace';
|
||||
import { useClientDataSWR } from '@/libs/swr';
|
||||
import { chatService } from '@/services/chat';
|
||||
import { messageService } from '@/services/message';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { TraceNameMap, TracePayload } from '@lobechat/types';
|
||||
import { produce } from 'immer';
|
||||
import { StateCreator } from 'zustand/vanilla';
|
||||
|
||||
import { chainLangDetect } from '@/chains/langDetect';
|
||||
import { chainTranslate } from '@/chains/translate';
|
||||
import { TraceNameMap, TracePayload } from '@/const/trace';
|
||||
import { supportLocales } from '@/locales/resources';
|
||||
import { chatService } from '@/services/chat';
|
||||
import { messageService } from '@/services/message';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { AgentRuntimeErrorType } from '@/libs/model-runtime';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType, ErrorResponse, ErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType, ErrorResponse, ErrorType } from '@lobechat/types';
|
||||
|
||||
import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '@/libs/model-runtime';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ErrorResponse } from '@lobechat/types/fetch';
|
||||
import { ErrorResponse } from '@lobechat/types';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { getMessageError } from '../parseError';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatErrorType } from '@lobechat/types/fetch';
|
||||
import { ChatErrorType } from '@lobechat/types';
|
||||
|
||||
import { MESSAGE_CANCEL_FLAT } from '@/const/message';
|
||||
import { LOBE_CHAT_OBSERVATION_ID, LOBE_CHAT_TRACE_ID } from '@/const/trace';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ErrorResponse, ErrorType } from '@lobechat/types/fetch';
|
||||
import { ErrorResponse, ErrorType } from '@lobechat/types';
|
||||
import { t } from 'i18next';
|
||||
|
||||
import { ChatMessageError } from '@/types/message';
|
||||
|
||||
Reference in New Issue
Block a user