@lobehub/chat 1.68.11 → 1.69.0
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.
- package/CHANGELOG.md +25 -0
- package/changelog/v1.json +9 -0
- package/locales/ar/chat.json +8 -0
- package/locales/bg-BG/chat.json +8 -0
- package/locales/de-DE/chat.json +8 -0
- package/locales/en-US/chat.json +8 -0
- package/locales/es-ES/chat.json +8 -0
- package/locales/fa-IR/chat.json +8 -0
- package/locales/fr-FR/chat.json +8 -0
- package/locales/it-IT/chat.json +8 -0
- package/locales/ja-JP/chat.json +8 -0
- package/locales/ko-KR/chat.json +8 -0
- package/locales/nl-NL/chat.json +8 -0
- package/locales/pl-PL/chat.json +8 -0
- package/locales/pt-BR/chat.json +8 -0
- package/locales/ru-RU/chat.json +8 -0
- package/locales/tr-TR/chat.json +8 -0
- package/locales/vi-VN/chat.json +8 -0
- package/locales/zh-CN/chat.json +8 -0
- package/locales/zh-TW/chat.json +8 -0
- package/next.config.ts +6 -0
- package/package.json +1 -1
- package/packages/web-crawler/src/crawImpl/naive.ts +19 -12
- package/packages/web-crawler/src/urlRules.ts +9 -1
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/ChatItem/index.tsx +9 -18
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/WelcomeMessage.tsx +2 -5
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/HeaderAction.tsx +3 -2
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx +56 -30
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Tags/HistoryLimitTags.tsx +26 -0
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/{SearchTags.tsx → Tags/SearchTags.tsx} +7 -4
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/{Tags.tsx → Tags/index.tsx} +4 -1
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/index.tsx +1 -1
- package/src/config/aiModels/anthropic.ts +16 -1
- package/src/config/modelProviders/anthropic.ts +0 -2
- package/src/const/layoutTokens.test.ts +1 -1
- package/src/const/layoutTokens.ts +1 -1
- package/src/const/models.ts +27 -0
- package/src/features/ChatInput/ActionBar/History.tsx +6 -3
- package/src/features/ChatInput/ActionBar/Model/ContextCachingSwitch.tsx +20 -0
- package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +49 -7
- package/src/features/ChatInput/ActionBar/Model/ReasoningTokenSlider.tsx +6 -14
- package/src/features/ChatInput/ActionBar/Search/ModelBuiltinSearch.tsx +2 -2
- package/src/features/ChatInput/ActionBar/Search/SwitchPanel.tsx +2 -2
- package/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +3 -5
- package/src/features/Conversation/Messages/Assistant/Tool/Render/CustomRender.tsx +2 -0
- package/src/features/Conversation/Messages/Assistant/Tool/Render/index.tsx +5 -1
- package/src/features/Conversation/Messages/Assistant/Tool/index.tsx +2 -0
- package/src/features/Conversation/components/ChatItem/index.tsx +3 -6
- package/src/features/Portal/Thread/Chat/ChatItem.tsx +4 -9
- package/src/hooks/useAgentEnableSearch.ts +2 -2
- package/src/libs/agent-runtime/anthropic/index.test.ts +36 -7
- package/src/libs/agent-runtime/anthropic/index.ts +30 -8
- package/src/libs/agent-runtime/azureOpenai/index.ts +4 -9
- package/src/libs/agent-runtime/azureai/index.ts +4 -9
- package/src/libs/agent-runtime/openai/index.ts +21 -38
- package/src/libs/agent-runtime/types/chat.ts +4 -0
- package/src/libs/agent-runtime/utils/anthropicHelpers.test.ts +55 -0
- package/src/libs/agent-runtime/utils/anthropicHelpers.ts +37 -3
- package/src/libs/langchain/loaders/code/__tests__/long.json +2 -2
- package/src/libs/langchain/loaders/code/__tests__/long.txt +1 -1
- package/src/locales/default/chat.ts +8 -0
- package/src/store/agent/initialState.ts +2 -2
- package/src/store/agent/selectors.ts +1 -1
- package/src/store/agent/slices/chat/{selectors.test.ts → selectors/agent.test.ts} +2 -2
- package/src/store/agent/slices/chat/{selectors.ts → selectors/agent.ts} +24 -33
- package/src/store/agent/slices/chat/selectors/chatConfig.test.ts +184 -0
- package/src/store/agent/slices/chat/selectors/chatConfig.ts +65 -0
- package/src/store/agent/slices/chat/selectors/index.ts +2 -0
- package/src/store/agent/store.ts +2 -2
- package/src/store/chat/helpers.test.ts +7 -7
- package/src/store/chat/helpers.ts +11 -7
- package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChat.test.ts +3 -3
- package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +11 -2
- package/src/store/chat/slices/aiChat/actions/helpers.ts +6 -2
- package/src/store/chat/slices/builtinTool/actions/searXNG.ts +28 -20
- package/src/store/chat/slices/message/selectors.ts +7 -3
- package/src/store/chat/slices/thread/selectors/index.ts +7 -3
- package/src/tools/web-browsing/Render/PageContent/Result.tsx +4 -2
- package/src/tools/web-browsing/Render/index.tsx +2 -0
- package/src/types/agent/index.ts +4 -0
- package/src/types/aiModel.ts +1 -1
- package/src/types/aiProvider.ts +60 -31
- /package/packages/web-crawler/src/{__test__ → __tests__}/crawler.test.ts +0 -0
- /package/packages/web-crawler/src/crawImpl/{__test__ → __tests__}/jina.test.ts +0 -0
- /package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/{KnowledgeTag.tsx → Tags/KnowledgeTag.tsx} +0 -0
- /package/src/store/agent/slices/chat/{__snapshots__/selectors.test.ts.snap → selectors/__snapshots__/agent.test.ts.snap} +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import { DEFAULT_USER_AVATAR } from '@/const/meta';
|
2
2
|
import { INBOX_SESSION_ID } from '@/const/session';
|
3
3
|
import { useAgentStore } from '@/store/agent';
|
4
|
-
import {
|
4
|
+
import { agentChatConfigSelectors } from '@/store/agent/selectors';
|
5
5
|
import { messageMapKey } from '@/store/chat/utils/messageMapKey';
|
6
6
|
import { useSessionStore } from '@/store/session';
|
7
7
|
import { sessionMetaSelectors } from '@/store/session/selectors';
|
@@ -84,9 +84,13 @@ const mainAIChats = (s: ChatStoreState): ChatMessage[] => {
|
|
84
84
|
|
85
85
|
const mainAIChatsWithHistoryConfig = (s: ChatStoreState): ChatMessage[] => {
|
86
86
|
const chats = mainAIChats(s);
|
87
|
-
const
|
87
|
+
const enableHistoryCount = agentChatConfigSelectors.enableHistoryCount(useAgentStore.getState());
|
88
|
+
const historyCount = agentChatConfigSelectors.historyCount(useAgentStore.getState());
|
88
89
|
|
89
|
-
return chatHelpers.
|
90
|
+
return chatHelpers.getSlicedMessages(chats, {
|
91
|
+
enableHistoryCount,
|
92
|
+
historyCount,
|
93
|
+
});
|
90
94
|
};
|
91
95
|
|
92
96
|
const mainAIChatsMessageString = (s: ChatStoreState): string => {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { THREAD_DRAFT_ID } from '@/const/message';
|
2
2
|
import { useAgentStore } from '@/store/agent';
|
3
|
-
import {
|
3
|
+
import { agentChatConfigSelectors } from '@/store/agent/selectors';
|
4
4
|
import type { ChatStoreState } from '@/store/chat';
|
5
5
|
import { chatHelpers } from '@/store/chat/helpers';
|
6
6
|
import { ChatMessage } from '@/types/message';
|
@@ -123,9 +123,13 @@ const portalAIChatsWithHistoryConfig = (s: ChatStoreState) => {
|
|
123
123
|
|
124
124
|
const messages = [...parentMessages, ...afterMessages].filter(Boolean) as ChatMessage[];
|
125
125
|
|
126
|
-
const
|
126
|
+
const enableHistoryCount = agentChatConfigSelectors.enableHistoryCount(useAgentStore.getState());
|
127
|
+
const historyCount = agentChatConfigSelectors.historyCount(useAgentStore.getState());
|
127
128
|
|
128
|
-
return chatHelpers.
|
129
|
+
return chatHelpers.getSlicedMessages(messages, {
|
130
|
+
enableHistoryCount,
|
131
|
+
historyCount,
|
132
|
+
});
|
129
133
|
};
|
130
134
|
|
131
135
|
const threadSourceMessageIndex = (s: ChatStoreState) => {
|
@@ -51,12 +51,13 @@ const useStyles = createStyles(({ token, css }) => {
|
|
51
51
|
}
|
52
52
|
`,
|
53
53
|
footer: css`
|
54
|
-
padding:
|
54
|
+
padding-block: 8px;
|
55
|
+
padding-inline: 16px;
|
55
56
|
text-align: center;
|
56
57
|
background-color: ${token.colorFillQuaternary};
|
57
58
|
`,
|
58
59
|
footerText: css`
|
59
|
-
font-size:
|
60
|
+
font-size: 12px !important;
|
60
61
|
color: ${token.colorTextTertiary} !important;
|
61
62
|
`,
|
62
63
|
metaInfo: css`
|
@@ -153,6 +154,7 @@ const CrawlerResultCard = memo<CrawlerData>(({ result, messageId, crawler, origi
|
|
153
154
|
<Descriptions
|
154
155
|
classNames={{
|
155
156
|
content: styles.footerText,
|
157
|
+
label: styles.footerText,
|
156
158
|
}}
|
157
159
|
column={2}
|
158
160
|
items={[
|
package/src/types/agent/index.ts
CHANGED
package/src/types/aiModel.ts
CHANGED
@@ -140,7 +140,7 @@ export interface AiModelConfig {
|
|
140
140
|
|
141
141
|
export type ModelSearchImplementType = 'tool' | 'params' | 'internal';
|
142
142
|
|
143
|
-
export type ExtendParamsType = 'reasoningBudgetToken' | 'enableReasoning';
|
143
|
+
export type ExtendParamsType = 'reasoningBudgetToken' | 'enableReasoning' | 'disableContextCaching';
|
144
144
|
|
145
145
|
export interface AiModelSettings {
|
146
146
|
extendParams?: ExtendParamsType[];
|
package/src/types/aiProvider.ts
CHANGED
@@ -32,37 +32,6 @@ export const AiProviderSDKEnum = {
|
|
32
32
|
|
33
33
|
export type AiProviderSDKType = (typeof AiProviderSDKEnum)[keyof typeof AiProviderSDKEnum];
|
34
34
|
|
35
|
-
// create
|
36
|
-
export const CreateAiProviderSchema = z.object({
|
37
|
-
config: z.object({}).passthrough().optional(),
|
38
|
-
description: z.string().optional(),
|
39
|
-
id: z.string(),
|
40
|
-
keyVaults: z.any().optional(),
|
41
|
-
logo: z.string().optional(),
|
42
|
-
name: z.string(),
|
43
|
-
sdkType: z.enum(['openai', 'anthropic']).optional(),
|
44
|
-
source: z.enum(['builtin', 'custom']),
|
45
|
-
// checkModel: z.string().optional(),
|
46
|
-
// homeUrl: z.string().optional(),
|
47
|
-
// modelsUrl: z.string().optional(),
|
48
|
-
});
|
49
|
-
|
50
|
-
export type CreateAiProviderParams = z.infer<typeof CreateAiProviderSchema>;
|
51
|
-
|
52
|
-
// List Query
|
53
|
-
|
54
|
-
export interface AiProviderListItem {
|
55
|
-
description?: string;
|
56
|
-
enabled: boolean;
|
57
|
-
id: string;
|
58
|
-
logo?: string;
|
59
|
-
name?: string;
|
60
|
-
sort?: number;
|
61
|
-
source: AiProviderSourceType;
|
62
|
-
}
|
63
|
-
|
64
|
-
// Detail Query
|
65
|
-
|
66
35
|
export interface AiProviderSettings {
|
67
36
|
/**
|
68
37
|
* whether provider show browser request option by default
|
@@ -115,6 +84,65 @@ export interface AiProviderSettings {
|
|
115
84
|
smoothing?: SmoothingParams;
|
116
85
|
}
|
117
86
|
|
87
|
+
const AiProviderSettingsSchema = z.object({
|
88
|
+
defaultShowBrowserRequest: z.boolean().optional(),
|
89
|
+
disableBrowserRequest: z.boolean().optional(),
|
90
|
+
modelEditable: z.boolean().optional(),
|
91
|
+
proxyUrl: z
|
92
|
+
.object({
|
93
|
+
desc: z.string().optional(),
|
94
|
+
placeholder: z.string(),
|
95
|
+
title: z.string().optional(),
|
96
|
+
})
|
97
|
+
.or(z.literal(false))
|
98
|
+
.optional(),
|
99
|
+
sdkType: z.enum(['anthropic', 'openai', 'ollama']).optional(),
|
100
|
+
searchMode: z.enum(['params', 'internal']).optional(),
|
101
|
+
showAddNewModel: z.boolean().optional(),
|
102
|
+
showApiKey: z.boolean().optional(),
|
103
|
+
showChecker: z.boolean().optional(),
|
104
|
+
showDeployName: z.boolean().optional(),
|
105
|
+
showModelFetcher: z.boolean().optional(),
|
106
|
+
smoothing: z
|
107
|
+
.object({
|
108
|
+
text: z.boolean().optional(),
|
109
|
+
toolsCalling: z.boolean().optional(),
|
110
|
+
})
|
111
|
+
.optional(),
|
112
|
+
});
|
113
|
+
|
114
|
+
// create
|
115
|
+
export const CreateAiProviderSchema = z.object({
|
116
|
+
config: z.object({}).passthrough().optional(),
|
117
|
+
description: z.string().optional(),
|
118
|
+
id: z.string(),
|
119
|
+
keyVaults: z.any().optional(),
|
120
|
+
logo: z.string().optional(),
|
121
|
+
name: z.string(),
|
122
|
+
sdkType: z.enum(['openai', 'anthropic']).optional(),
|
123
|
+
settings: AiProviderSettingsSchema.optional(),
|
124
|
+
source: z.enum(['builtin', 'custom']),
|
125
|
+
// checkModel: z.string().optional(),
|
126
|
+
// homeUrl: z.string().optional(),
|
127
|
+
// modelsUrl: z.string().optional(),
|
128
|
+
});
|
129
|
+
|
130
|
+
export type CreateAiProviderParams = z.infer<typeof CreateAiProviderSchema>;
|
131
|
+
|
132
|
+
// List Query
|
133
|
+
|
134
|
+
export interface AiProviderListItem {
|
135
|
+
description?: string;
|
136
|
+
enabled: boolean;
|
137
|
+
id: string;
|
138
|
+
logo?: string;
|
139
|
+
name?: string;
|
140
|
+
sort?: number;
|
141
|
+
source: AiProviderSourceType;
|
142
|
+
}
|
143
|
+
|
144
|
+
// Detail Query
|
145
|
+
|
118
146
|
export interface AiProviderCard {
|
119
147
|
/**
|
120
148
|
* the default model that used for connection check
|
@@ -174,6 +202,7 @@ export const UpdateAiProviderSchema = z.object({
|
|
174
202
|
logo: z.string().nullable().optional(),
|
175
203
|
name: z.string(),
|
176
204
|
sdkType: z.enum(['openai', 'anthropic']).optional(),
|
205
|
+
settings: AiProviderSettingsSchema.optional(),
|
177
206
|
});
|
178
207
|
|
179
208
|
export type UpdateAiProviderParams = z.infer<typeof UpdateAiProviderSchema>;
|
File without changes
|
File without changes
|
File without changes
|