@lobehub/chat 1.110.3 → 1.110.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/changelog/v1.json +9 -0
  3. package/package.json +1 -1
  4. package/packages/types/package.json +5 -13
  5. package/packages/types/src/aiProvider.ts +2 -2
  6. package/packages/types/src/importer.ts +4 -4
  7. package/packages/types/src/index.ts +3 -0
  8. package/packages/types/src/llm.ts +2 -2
  9. package/packages/types/src/rag.ts +1 -1
  10. package/packages/types/src/serverConfig.ts +3 -6
  11. package/packages/types/src/trace/action.ts +24 -1
  12. package/packages/types/src/trace/enum.ts +32 -0
  13. package/packages/types/src/trace/index.ts +1 -0
  14. package/packages/types/src/user/index.ts +3 -3
  15. package/src/app/(backend)/_deprecated/createBizOpenAI/auth.ts +1 -1
  16. package/src/app/(backend)/_deprecated/createBizOpenAI/createAzureOpenai.ts +1 -1
  17. package/src/app/(backend)/_deprecated/createBizOpenAI/createOpenai.ts +1 -1
  18. package/src/app/(backend)/_deprecated/createBizOpenAI/index.ts +1 -1
  19. package/src/app/(backend)/middleware/auth/index.test.ts +1 -1
  20. package/src/app/(backend)/middleware/auth/index.ts +1 -1
  21. package/src/app/(backend)/middleware/auth/utils.ts +1 -1
  22. package/src/app/(backend)/webapi/chat/[provider]/route.test.ts +1 -1
  23. package/src/app/(backend)/webapi/chat/[provider]/route.ts +1 -1
  24. package/src/app/(backend)/webapi/models/[provider]/pull/route.ts +1 -1
  25. package/src/app/(backend)/webapi/models/[provider]/route.ts +1 -1
  26. package/src/app/(backend)/webapi/plugin/gateway/route.ts +2 -2
  27. package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +1 -1
  28. package/src/app/(backend)/webapi/trace/route.ts +1 -1
  29. package/src/app/[variants]/(main)/settings/llm/components/Checker.tsx +1 -1
  30. package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/Checker.tsx +1 -1
  31. package/src/const/trace.ts +2 -33
  32. package/src/features/AgentSetting/store/action.ts +2 -2
  33. package/src/features/Conversation/Error/index.tsx +1 -1
  34. package/src/features/Portal/Artifacts/Header.tsx +1 -1
  35. package/src/libs/model-runtime/ModelRuntime.test.ts +1 -1
  36. package/src/libs/model-runtime/ModelRuntime.ts +1 -2
  37. package/src/libs/traces/event.test.ts +1 -2
  38. package/src/libs/traces/event.ts +1 -1
  39. package/src/server/modules/ModelRuntime/trace.ts +2 -6
  40. package/src/services/__tests__/chat.test.ts +1 -1
  41. package/src/services/chat.ts +1 -2
  42. package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +1 -1
  43. package/src/store/chat/slices/aiChat/actions/memory.ts +1 -1
  44. package/src/store/chat/slices/message/action.test.ts +1 -1
  45. package/src/store/chat/slices/message/action.ts +1 -2
  46. package/src/store/chat/slices/plugin/action.ts +1 -1
  47. package/src/store/chat/slices/topic/action.ts +1 -1
  48. package/src/store/chat/slices/translate/action.ts +1 -1
  49. package/src/utils/errorResponse.test.ts +1 -1
  50. package/src/utils/errorResponse.ts +1 -1
  51. package/src/utils/fetch/__tests__/parseError.test.ts +1 -1
  52. package/src/utils/fetch/fetchSSE.ts +1 -1
  53. package/src/utils/fetch/parseError.ts +1 -1
  54. package/packages/types/src/share.ts +0 -7
  55. /package/{packages/types/src → src/types}/locale.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.110.4](https://github.com/lobehub/lobe-chat/compare/v1.110.3...v1.110.4)
6
+
7
+ <sup>Released on **2025-08-06**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Refactor trace type.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Refactor trace type, closes [#8699](https://github.com/lobehub/lobe-chat/issues/8699) ([4e71af7](https://github.com/lobehub/lobe-chat/commit/4e71af7))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 1.110.3](https://github.com/lobehub/lobe-chat/compare/v1.110.2...v1.110.3)
6
31
 
7
32
  <sup>Released on **2025-08-06**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Refactor trace type."
6
+ ]
7
+ },
8
+ "date": "2025-08-06",
9
+ "version": "1.110.4"
10
+ },
2
11
  {
3
12
  "children": {
4
13
  "improvements": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.110.3",
3
+ "version": "1.110.4",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -2,19 +2,11 @@
2
2
  "name": "@lobechat/types",
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
- "exports": {
6
- "./*": {
7
- "types": [
8
- "./src/*.ts",
9
- "./src/*/index.ts"
10
- ],
11
- "default": [
12
- "./src/*.ts",
13
- "./src/*/index.ts"
14
- ]
15
- }
16
- },
5
+ "main": "./src/index.ts",
17
6
  "dependencies": {
18
- "@lobehub/chat-plugin-sdk": "^1.32.4"
7
+ "@lobechat/web-crawler": "workspace:*",
8
+ "@lobehub/chat-plugin-sdk": "^1.32.4",
9
+ "type-fest": "^4.41.0",
10
+ "zod": "^3.25.76"
19
11
  }
20
12
  }
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
- import { AiModelForSelect, EnabledAiModel, ModelSearchImplementType } from '@/types/aiModel';
4
- import { ResponseAnimation } from '@/types/llm';
3
+ import { AiModelForSelect, EnabledAiModel, ModelSearchImplementType } from './aiModel';
4
+ import { ResponseAnimation } from './llm';
5
5
 
6
6
  export const AiProviderSourceEnum = {
7
7
  Builtin: 'builtin',
@@ -1,4 +1,4 @@
1
- import { LobeAgentConfig } from '@/types/agent';
1
+ import { LobeAgentConfig } from './agent';
2
2
  import {
3
3
  ChatMessageError,
4
4
  ChatPluginPayload,
@@ -6,9 +6,9 @@ import {
6
6
  ChatToolPayload,
7
7
  ChatTranslate,
8
8
  MessageRoleType,
9
- } from '@/types/message';
10
- import { MetaData } from '@/types/meta';
11
- import { SessionGroupId } from '@/types/session';
9
+ } from './message';
10
+ import { MetaData } from './meta';
11
+ import { SessionGroupId } from './session';
12
12
 
13
13
  export interface ImportSession {
14
14
  config: LobeAgentConfig;
@@ -0,0 +1,3 @@
1
+ export * from './artifact';
2
+ export * from './fetch';
3
+ export * from './trace';
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
 
3
- import { AiModelType, ChatModelPricing } from '@/types/aiModel';
4
- import { AiProviderSettings } from '@/types/aiProvider';
3
+ import { AiModelType, ChatModelPricing } from './aiModel';
4
+ import { AiProviderSettings } from './aiProvider';
5
5
 
6
6
  export type ModelPriceCurrency = 'CNY' | 'USD';
7
7
 
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- import { ChatSemanticSearchChunk } from '@/types/chunk';
3
+ import { ChatSemanticSearchChunk } from './chunk';
4
4
 
5
5
  export const SemanticSearchSchema = z.object({
6
6
  fileIds: z.array(z.string()).optional(),
@@ -1,12 +1,9 @@
1
1
  import type { PartialDeep } from 'type-fest';
2
2
 
3
3
  import { IFeatureFlags } from '@/config/featureFlags';
4
- import { ChatModelCard } from '@/types/llm';
5
- import {
6
- GlobalLLMProviderKey,
7
- UserDefaultAgent,
8
- UserSystemAgentConfig,
9
- } from '@/types/user/settings';
4
+
5
+ import { ChatModelCard } from './llm';
6
+ import { GlobalLLMProviderKey, UserDefaultAgent, UserSystemAgentConfig } from './user/settings';
10
7
 
11
8
  export interface ServerModelProviderConfig {
12
9
  enabled?: boolean;
@@ -1,4 +1,4 @@
1
- import { TraceEventType } from '@/const/trace';
1
+ import { TraceEventType, TraceNameMap } from './enum';
2
2
 
3
3
  export interface TraceEventBasePayload {
4
4
  content: string;
@@ -29,3 +29,26 @@ export type TraceEventPayloads =
29
29
  | TraceEventModifyMessage
30
30
  | TraceEventDeleteAndRegenerateMessage
31
31
  | TraceEventRegenerateMessage;
32
+
33
+ export interface TracePayload {
34
+ /**
35
+ * if user allow to trace
36
+ */
37
+ enabled?: boolean;
38
+ observationId?: string;
39
+ /**
40
+ * chat session: agentId or groupId
41
+ */
42
+ sessionId?: string;
43
+ tags?: string[];
44
+ /**
45
+ * chat topicId
46
+ */
47
+ topicId?: string;
48
+ traceId?: string;
49
+ traceName?: TraceNameMap;
50
+ /**
51
+ * user uuid
52
+ */
53
+ userId?: string;
54
+ }
@@ -0,0 +1,32 @@
1
+ export enum TraceNameMap {
2
+ ConnectivityChecker = 'Connectivity Checker',
3
+ Conversation = 'Conversation',
4
+ EmojiPicker = 'Emoji Picker',
5
+ FetchPluginAPI = 'Fetch Plugin API',
6
+ LanguageDetect = 'Language Detect',
7
+ SearchIntentRecognition = 'Search Intent Recognition',
8
+ SummaryAgentDescription = 'Summary Agent Description',
9
+ SummaryAgentTags = 'Summary Agent Tags',
10
+ SummaryAgentTitle = 'Summary Agent Title',
11
+ SummaryHistoryMessages = 'Summary History Messages',
12
+ SummaryTopicTitle = 'Summary Topic Title',
13
+ Translator = 'Translator',
14
+ }
15
+
16
+ export enum TraceEventType {
17
+ CopyMessage = 'Copy Message',
18
+ DeleteAndRegenerateMessage = 'Delete And Regenerate Message',
19
+ ModifyMessage = 'Modify Message',
20
+ RegenerateMessage = 'Regenerate Message',
21
+ }
22
+
23
+ export enum TraceTopicType {
24
+ AgentSettings = 'Agent Settings',
25
+ }
26
+
27
+ export enum TraceTagMap {
28
+ Chat = 'Chat Competition',
29
+ SystemChain = 'System Chain',
30
+ ToolCalling = 'Tool Calling',
31
+ ToolsCalling = 'Tools Calling',
32
+ }
@@ -1 +1,2 @@
1
1
  export * from './action';
2
+ export * from './enum';
@@ -1,9 +1,9 @@
1
1
  import type { PartialDeep } from 'type-fest';
2
2
  import { z } from 'zod';
3
3
 
4
- import { Plans } from '@/types/subscription';
5
- import { TopicDisplayMode } from '@/types/topic';
6
- import { UserSettings } from '@/types/user/settings';
4
+ import { Plans } from '../subscription';
5
+ import { TopicDisplayMode } from '../topic';
6
+ import { UserSettings } from '../user/settings';
7
7
 
8
8
  export interface LobeUser {
9
9
  avatar?: string;
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
 
3
3
  import { getAppConfig } from '@/envs/app';
4
4
 
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
  import OpenAI, { ClientOptions } from 'openai';
3
3
  import urlJoin from 'url-join';
4
4
 
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
  import OpenAI from 'openai';
3
3
 
4
4
  import { getLLMConfig } from '@/config/llm';
@@ -1,4 +1,4 @@
1
- import { ChatErrorType, ErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType, ErrorType } from '@lobechat/types';
2
2
  import OpenAI from 'openai';
3
3
 
4
4
  import { getOpenAIAuthFromRequest } from '@/const/fetch';
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { AgentRuntimeError } from '@/libs/model-runtime';
@@ -1,5 +1,5 @@
1
1
  import { AuthObject } from '@clerk/backend';
2
- import { ChatErrorType } from '@lobechat/types/fetch';
2
+ import { ChatErrorType } from '@lobechat/types';
3
3
  import { NextRequest } from 'next/server';
4
4
 
5
5
  import {
@@ -1,5 +1,5 @@
1
1
  import { type AuthObject } from '@clerk/backend';
2
- import { ChatErrorType } from '@lobechat/types/fetch';
2
+ import { ChatErrorType } from '@lobechat/types';
3
3
 
4
4
  import { enableClerk, enableNextAuth } from '@/const/auth';
5
5
  import { getAppConfig } from '@/envs/app';
@@ -1,6 +1,6 @@
1
1
  // @vitest-environment node
2
2
  import { getAuth } from '@clerk/nextjs/server';
3
- import { ChatErrorType } from '@lobechat/types/fetch';
3
+ import { ChatErrorType } from '@lobechat/types';
4
4
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5
5
 
6
6
  import { checkAuthMethod } from '@/app/(backend)/middleware/auth/utils';
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
 
3
3
  import { checkAuth } from '@/app/(backend)/middleware/auth';
4
4
  import {
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
 
3
3
  import { checkAuth } from '@/app/(backend)/middleware/auth';
4
4
  import { ChatCompletionErrorPayload, PullModelParams } from '@/libs/model-runtime';
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
  import { NextResponse } from 'next/server';
3
3
 
4
4
  import { checkAuth } from '@/app/(backend)/middleware/auth';
@@ -1,9 +1,9 @@
1
- import { ChatErrorType, ErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType, ErrorType , TraceNameMap } from '@lobechat/types';
2
2
  import { PluginRequestPayload } from '@lobehub/chat-plugin-sdk';
3
3
  import { createGatewayOnEdgeRuntime } from '@lobehub/chat-plugins-gateway';
4
4
 
5
5
  import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED, enableNextAuth } from '@/const/auth';
6
- import { LOBE_CHAT_TRACE_ID, TraceNameMap } from '@/const/trace';
6
+ import { LOBE_CHAT_TRACE_ID } from '@/const/trace';
7
7
  import { getAppConfig } from '@/envs/app';
8
8
  import { AgentRuntimeError } from '@/libs/model-runtime';
9
9
  import { TraceClient } from '@/libs/traces';
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
  import { NextResponse } from 'next/server';
3
3
 
4
4
  import { checkAuth } from '@/app/(backend)/middleware/auth';
@@ -1,6 +1,6 @@
1
+ import { TraceEventType } from '@lobechat/types';
1
2
  import { after } from 'next/server';
2
3
 
3
- import { TraceEventType } from '@/const/trace';
4
4
  import { TraceClient } from '@/libs/traces';
5
5
  import { TraceEventBasePayload, TraceEventPayloads } from '@/types/trace';
6
6
 
@@ -1,13 +1,13 @@
1
1
  'use client';
2
2
 
3
3
  import { CheckCircleFilled } from '@ant-design/icons';
4
+ import { TraceNameMap } from '@lobechat/types';
4
5
  import { Alert, Button, Highlighter } from '@lobehub/ui';
5
6
  import { useTheme } from 'antd-style';
6
7
  import { memo, useState } from 'react';
7
8
  import { useTranslation } from 'react-i18next';
8
9
  import { Flexbox } from 'react-layout-kit';
9
10
 
10
- import { TraceNameMap } from '@/const/trace';
11
11
  import { useIsMobile } from '@/hooks/useIsMobile';
12
12
  import { useProviderName } from '@/hooks/useProviderName';
13
13
  import { chatService } from '@/services/chat';
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { CheckCircleFilled } from '@ant-design/icons';
4
+ import { TraceNameMap } from '@lobechat/types';
4
5
  import { ModelIcon } from '@lobehub/icons';
5
6
  import { Alert, Button, Highlighter, Icon, Select } from '@lobehub/ui';
6
7
  import { useTheme } from 'antd-style';
@@ -9,7 +10,6 @@ import { ReactNode, memo, useState } from 'react';
9
10
  import { useTranslation } from 'react-i18next';
10
11
  import { Flexbox } from 'react-layout-kit';
11
12
 
12
- import { TraceNameMap } from '@/const/trace';
13
13
  import { useProviderName } from '@/hooks/useProviderName';
14
14
  import { chatService } from '@/services/chat';
15
15
  import { aiModelSelectors, aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
@@ -1,40 +1,9 @@
1
+ import { TraceNameMap } from '@/types/trace';
2
+
1
3
  export const LOBE_CHAT_TRACE_HEADER = 'X-lobe-trace';
2
4
  export const LOBE_CHAT_TRACE_ID = 'X-lobe-chat-trace-id';
3
5
  export const LOBE_CHAT_OBSERVATION_ID = 'X-lobe-observation-id';
4
6
 
5
- export enum TraceNameMap {
6
- ConnectivityChecker = 'Connectivity Checker',
7
- Conversation = 'Conversation',
8
- EmojiPicker = 'Emoji Picker',
9
- FetchPluginAPI = 'Fetch Plugin API',
10
- LanguageDetect = 'Language Detect',
11
- SearchIntentRecognition = 'Search Intent Recognition',
12
- SummaryAgentDescription = 'Summary Agent Description',
13
- SummaryAgentTags = 'Summary Agent Tags',
14
- SummaryAgentTitle = 'Summary Agent Title',
15
- SummaryHistoryMessages = 'Summary History Messages',
16
- SummaryTopicTitle = 'Summary Topic Title',
17
- Translator = 'Translator',
18
- }
19
-
20
- export enum TraceEventType {
21
- CopyMessage = 'Copy Message',
22
- DeleteAndRegenerateMessage = 'Delete And Regenerate Message',
23
- ModifyMessage = 'Modify Message',
24
- RegenerateMessage = 'Regenerate Message',
25
- }
26
-
27
- export enum TraceTopicType {
28
- AgentSettings = 'Agent Settings',
29
- }
30
-
31
- export enum TraceTagMap {
32
- Chat = 'Chat Competition',
33
- SystemChain = 'System Chain',
34
- ToolCalling = 'Tool Calling',
35
- ToolsCalling = 'Tools Calling',
36
- }
37
-
38
7
  export interface TracePayload {
39
8
  /**
40
9
  * if user allow to trace
@@ -1,12 +1,12 @@
1
- import type { PartialDeep } from 'type-fest';
1
+ import { TraceNameMap, TracePayload, TraceTopicType } from '@lobechat/types';
2
2
  import { getSingletonAnalyticsOptional } from '@lobehub/analytics';
3
+ import type { PartialDeep } from 'type-fest';
3
4
  import { StateCreator } from 'zustand/vanilla';
4
5
 
5
6
  import { chainPickEmoji } from '@/chains/pickEmoji';
6
7
  import { chainSummaryAgentName } from '@/chains/summaryAgentName';
7
8
  import { chainSummaryDescription } from '@/chains/summaryDescription';
8
9
  import { chainSummaryTags } from '@/chains/summaryTags';
9
- import { TraceNameMap, TracePayload, TraceTopicType } from '@/const/trace';
10
10
  import { chatService } from '@/services/chat';
11
11
  import { useUserStore } from '@/store/user';
12
12
  import { systemAgentSelectors } from '@/store/user/slices/settings/selectors';
@@ -1,4 +1,4 @@
1
- import { ChatErrorType, ErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType, ErrorType } from '@lobechat/types';
2
2
  import { IPluginErrorType } from '@lobehub/chat-plugin-sdk';
3
3
  import type { AlertProps } from '@lobehub/ui';
4
4
  import { Skeleton } from 'antd';
@@ -1,4 +1,4 @@
1
- import { ArtifactType } from '@lobechat/types/artifact';
1
+ import { ArtifactType } from '@lobechat/types';
2
2
  import { ActionIcon, Icon, Segmented, Text } from '@lobehub/ui';
3
3
  import { ConfigProvider } from 'antd';
4
4
  import { cx } from 'antd-style';
@@ -1,11 +1,11 @@
1
1
  // @vitest-environment node
2
+ import { TraceNameMap } from '@lobechat/types';
2
3
  import { Langfuse } from 'langfuse';
3
4
  import { LangfuseGenerationClient, LangfuseTraceClient } from 'langfuse-core';
4
5
  import { beforeEach, describe, expect, it, vi } from 'vitest';
5
6
 
6
7
  import * as langfuseCfg from '@/config/langfuse';
7
8
  import { ClientSecretPayload } from '@/const/auth';
8
- import { TraceNameMap } from '@/const/trace';
9
9
  import { ChatStreamPayload, LobeOpenAI, ModelProvider, ModelRuntime } from '@/libs/model-runtime';
10
10
  import { providerRuntimeMap } from '@/libs/model-runtime/runtimeMap';
11
11
  import { CreateImagePayload } from '@/libs/model-runtime/types/image';
@@ -1,7 +1,6 @@
1
+ import type { TracePayload } from '@lobechat/types';
1
2
  import { ClientOptions } from 'openai';
2
3
 
3
- import type { TracePayload } from '@/const/trace';
4
-
5
4
  import { LobeRuntimeAI } from './BaseAI';
6
5
  import { LobeBedrockAIParams } from './bedrock';
7
6
  import { LobeCloudflareParams } from './cloudflare';
@@ -1,9 +1,8 @@
1
+ import { TraceEventType } from '@lobechat/types';
1
2
  import { diffChars } from 'diff';
2
3
  import { LangfuseTraceClient } from 'langfuse-core';
3
4
  import { describe, expect, it } from 'vitest';
4
5
 
5
- import { TraceEventType } from '@/const/trace';
6
-
7
6
  import { EventScore, TraceEventClient } from './event';
8
7
 
9
8
  describe('TraceEventClient', () => {
@@ -1,7 +1,7 @@
1
+ import { TraceEventType } from '@lobechat/types';
1
2
  import { diffChars } from 'diff';
2
3
  import { LangfuseTraceClient } from 'langfuse-core';
3
4
 
4
- import { TraceEventType } from '@/const/trace';
5
5
  import {
6
6
  TraceEventBasePayload,
7
7
  TraceEventCopyMessage,
@@ -1,12 +1,8 @@
1
+ import { TracePayload, TraceTagMap } from '@lobechat/types';
1
2
  import { after } from 'next/server';
2
3
 
3
4
  import { INBOX_SESSION_ID } from '@/const/session';
4
- import {
5
- LOBE_CHAT_OBSERVATION_ID,
6
- LOBE_CHAT_TRACE_ID,
7
- TracePayload,
8
- TraceTagMap,
9
- } from '@/const/trace';
5
+ import { LOBE_CHAT_OBSERVATION_ID, LOBE_CHAT_TRACE_ID } from '@/const/trace';
10
6
  import { ChatStreamCallbacks, ChatStreamPayload } from '@/libs/model-runtime';
11
7
  import { TraceClient } from '@/libs/traces';
12
8
 
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
  import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk';
3
3
  import { act } from '@testing-library/react';
4
4
  import { merge } from 'lodash-es';
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType , TracePayload, TraceTagMap } from '@lobechat/types';
2
2
  import { PluginRequestPayload, createHeadersWithPluginSettings } from '@lobehub/chat-plugin-sdk';
3
3
  import { produce } from 'immer';
4
4
  import { merge } from 'lodash-es';
@@ -7,7 +7,6 @@ import { enableAuth } from '@/const/auth';
7
7
  import { INBOX_GUIDE_SYSTEMROLE } from '@/const/guide';
8
8
  import { INBOX_SESSION_ID } from '@/const/session';
9
9
  import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
10
- import { TracePayload, TraceTagMap } from '@/const/trace';
11
10
  import { isDeprecatedEdition, isDesktop, isServerMode } from '@/const/version';
12
11
  import {
13
12
  AgentRuntimeError,
@@ -1,12 +1,12 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
2
2
  // Disable the auto sort key eslint rule to make the code more logic and readable
3
+ import { TraceEventType, TraceNameMap } from '@lobechat/types';
3
4
  import { t } from 'i18next';
4
5
  import { produce } from 'immer';
5
6
  import { template } from 'lodash-es';
6
7
  import { StateCreator } from 'zustand/vanilla';
7
8
 
8
9
  import { LOADING_FLAT, MESSAGE_CANCEL_FLAT } from '@/const/message';
9
- import { TraceEventType, TraceNameMap } from '@/const/trace';
10
10
  import { isDesktop, isServerMode } from '@/const/version';
11
11
  import { knowledgeBaseQAPrompts } from '@/prompts/knowledgeBaseQA';
12
12
  import { chatService } from '@/services/chat';
@@ -1,7 +1,7 @@
1
+ import { TraceNameMap } from '@lobechat/types';
1
2
  import { StateCreator } from 'zustand/vanilla';
2
3
 
3
4
  import { chainSummaryHistory } from '@/chains/summaryHistory';
4
- import { TraceNameMap } from '@/const/trace';
5
5
  import { chatService } from '@/services/chat';
6
6
  import { topicService } from '@/services/topic';
7
7
  import { ChatStore } from '@/store/chat';
@@ -1,9 +1,9 @@
1
+ import { TraceEventType } from '@lobechat/types';
1
2
  import * as lobeUIModules from '@lobehub/ui';
2
3
  import { act, renderHook, waitFor } from '@testing-library/react';
3
4
  import { mutate } from 'swr';
4
5
  import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5
6
 
6
- import { TraceEventType } from '@/const/trace';
7
7
  import { messageService } from '@/services/message';
8
8
  import { topicService } from '@/services/topic';
9
9
  import { messageMapKey } from '@/store/chat/utils/messageMapKey';
@@ -1,12 +1,11 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
2
2
  // Disable the auto sort key eslint rule to make the code more logic and readable
3
- import { ChatErrorType } from '@lobechat/types/fetch';
3
+ import { ChatErrorType, TraceEventType } from '@lobechat/types';
4
4
  import { copyToClipboard } from '@lobehub/ui';
5
5
  import isEqual from 'fast-deep-equal';
6
6
  import { SWRResponse, mutate } from 'swr';
7
7
  import { StateCreator } from 'zustand/vanilla';
8
8
 
9
- import { TraceEventType } from '@/const/trace';
10
9
  import { useClientDataSWR } from '@/libs/swr';
11
10
  import { messageService } from '@/services/message';
12
11
  import { topicService } from '@/services/topic';
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
2
- import { ChatErrorType } from '@lobechat/types/fetch';
2
+ import { ChatErrorType } from '@lobechat/types';
3
3
  import { PluginErrorType } from '@lobehub/chat-plugin-sdk';
4
4
  import isEqual from 'fast-deep-equal';
5
5
  import { t } from 'i18next';
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
2
2
  // Note: To make the code more logic and readable, we just disable the auto sort key eslint rule
3
3
  // DON'T REMOVE THE FIRST LINE
4
+ import { TraceNameMap } from '@lobechat/types';
4
5
  import isEqual from 'fast-deep-equal';
5
6
  import { t } from 'i18next';
6
7
  import useSWR, { SWRResponse, mutate } from 'swr';
@@ -9,7 +10,6 @@ import { StateCreator } from 'zustand/vanilla';
9
10
  import { chainSummaryTitle } from '@/chains/summaryTitle';
10
11
  import { message } from '@/components/AntdStaticMethods';
11
12
  import { LOADING_FLAT } from '@/const/message';
12
- import { TraceNameMap } from '@/const/trace';
13
13
  import { useClientDataSWR } from '@/libs/swr';
14
14
  import { chatService } from '@/services/chat';
15
15
  import { messageService } from '@/services/message';
@@ -1,9 +1,9 @@
1
+ import { TraceNameMap, TracePayload } from '@lobechat/types';
1
2
  import { produce } from 'immer';
2
3
  import { StateCreator } from 'zustand/vanilla';
3
4
 
4
5
  import { chainLangDetect } from '@/chains/langDetect';
5
6
  import { chainTranslate } from '@/chains/translate';
6
- import { TraceNameMap, TracePayload } from '@/const/trace';
7
7
  import { supportLocales } from '@/locales/resources';
8
8
  import { chatService } from '@/services/chat';
9
9
  import { messageService } from '@/services/message';
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
  import { describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { AgentRuntimeErrorType } from '@/libs/model-runtime';
@@ -1,4 +1,4 @@
1
- import { ChatErrorType, ErrorResponse, ErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType, ErrorResponse, ErrorType } from '@lobechat/types';
2
2
 
3
3
  import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '@/libs/model-runtime';
4
4
 
@@ -1,4 +1,4 @@
1
- import { ErrorResponse } from '@lobechat/types/fetch';
1
+ import { ErrorResponse } from '@lobechat/types';
2
2
  import { afterEach, describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { getMessageError } from '../parseError';
@@ -1,4 +1,4 @@
1
- import { ChatErrorType } from '@lobechat/types/fetch';
1
+ import { ChatErrorType } from '@lobechat/types';
2
2
 
3
3
  import { MESSAGE_CANCEL_FLAT } from '@/const/message';
4
4
  import { LOBE_CHAT_OBSERVATION_ID, LOBE_CHAT_TRACE_ID } from '@/const/trace';
@@ -1,4 +1,4 @@
1
- import { ErrorResponse, ErrorType } from '@lobechat/types/fetch';
1
+ import { ErrorResponse, ErrorType } from '@lobechat/types';
2
2
  import { t } from 'i18next';
3
3
 
4
4
  import { ChatMessageError } from '@/types/message';
@@ -1,7 +0,0 @@
1
- export interface ShareGPTConversation {
2
- avatarUrl?: string | null;
3
- items: Array<{
4
- from: 'human' | 'gpt';
5
- value: any;
6
- }>;
7
- }
File without changes