@lobehub/chat 1.138.1 → 1.138.3
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 +50 -0
- package/changelog/v1.json +18 -0
- package/docker-compose/local/docker-compose.yml +1 -1
- package/docker-compose/local/grafana/docker-compose.yml +1 -1
- package/docker-compose/production/grafana/docker-compose.yml +1 -1
- package/locales/ar/chat.json +1 -1
- package/locales/ar/common.json +1 -1
- package/locales/ar/models.json +35 -8
- package/locales/ar/plugin.json +1 -1
- package/locales/ar/welcome.json +1 -1
- package/locales/bg-BG/chat.json +1 -1
- package/locales/bg-BG/common.json +1 -1
- package/locales/bg-BG/models.json +35 -8
- package/locales/bg-BG/plugin.json +1 -1
- package/locales/bg-BG/welcome.json +1 -1
- package/locales/de-DE/chat.json +1 -1
- package/locales/de-DE/common.json +1 -1
- package/locales/de-DE/models.json +35 -8
- package/locales/de-DE/plugin.json +1 -1
- package/locales/de-DE/welcome.json +1 -1
- package/locales/en-US/chat.json +1 -1
- package/locales/en-US/common.json +1 -1
- package/locales/en-US/models.json +35 -8
- package/locales/en-US/plugin.json +1 -1
- package/locales/en-US/welcome.json +1 -1
- package/locales/es-ES/chat.json +1 -1
- package/locales/es-ES/common.json +1 -1
- package/locales/es-ES/models.json +35 -8
- package/locales/es-ES/plugin.json +1 -1
- package/locales/es-ES/welcome.json +1 -1
- package/locales/fa-IR/chat.json +1 -1
- package/locales/fa-IR/common.json +1 -1
- package/locales/fa-IR/models.json +35 -8
- package/locales/fa-IR/plugin.json +1 -1
- package/locales/fa-IR/welcome.json +1 -1
- package/locales/fr-FR/chat.json +1 -1
- package/locales/fr-FR/common.json +1 -1
- package/locales/fr-FR/models.json +35 -8
- package/locales/fr-FR/plugin.json +1 -1
- package/locales/fr-FR/welcome.json +1 -1
- package/locales/it-IT/chat.json +1 -1
- package/locales/it-IT/common.json +1 -1
- package/locales/it-IT/models.json +35 -8
- package/locales/it-IT/plugin.json +1 -1
- package/locales/it-IT/welcome.json +1 -1
- package/locales/ja-JP/chat.json +1 -1
- package/locales/ja-JP/common.json +1 -1
- package/locales/ja-JP/models.json +35 -8
- package/locales/ja-JP/plugin.json +1 -1
- package/locales/ja-JP/welcome.json +1 -1
- package/locales/ko-KR/chat.json +1 -1
- package/locales/ko-KR/common.json +1 -1
- package/locales/ko-KR/models.json +35 -8
- package/locales/ko-KR/plugin.json +1 -1
- package/locales/ko-KR/welcome.json +1 -1
- package/locales/nl-NL/chat.json +1 -1
- package/locales/nl-NL/common.json +1 -1
- package/locales/nl-NL/models.json +35 -8
- package/locales/nl-NL/plugin.json +1 -1
- package/locales/nl-NL/welcome.json +1 -1
- package/locales/pl-PL/chat.json +1 -1
- package/locales/pl-PL/common.json +1 -1
- package/locales/pl-PL/models.json +35 -8
- package/locales/pl-PL/plugin.json +1 -1
- package/locales/pl-PL/welcome.json +1 -1
- package/locales/pt-BR/chat.json +1 -1
- package/locales/pt-BR/common.json +1 -1
- package/locales/pt-BR/models.json +35 -8
- package/locales/pt-BR/plugin.json +1 -1
- package/locales/pt-BR/welcome.json +1 -1
- package/locales/ru-RU/chat.json +1 -1
- package/locales/ru-RU/common.json +1 -1
- package/locales/ru-RU/models.json +35 -8
- package/locales/ru-RU/plugin.json +1 -1
- package/locales/ru-RU/welcome.json +1 -1
- package/locales/tr-TR/chat.json +1 -1
- package/locales/tr-TR/common.json +1 -1
- package/locales/tr-TR/models.json +35 -8
- package/locales/tr-TR/plugin.json +1 -1
- package/locales/tr-TR/welcome.json +1 -1
- package/locales/vi-VN/chat.json +1 -1
- package/locales/vi-VN/common.json +1 -1
- package/locales/vi-VN/models.json +35 -8
- package/locales/vi-VN/plugin.json +1 -1
- package/locales/vi-VN/welcome.json +1 -1
- package/locales/zh-CN/common.json +1 -1
- package/locales/zh-CN/models.json +35 -8
- package/locales/zh-CN/plugin.json +1 -1
- package/locales/zh-CN/welcome.json +1 -1
- package/locales/zh-TW/chat.json +1 -1
- package/locales/zh-TW/common.json +1 -1
- package/locales/zh-TW/models.json +35 -8
- package/locales/zh-TW/plugin.json +1 -1
- package/locales/zh-TW/welcome.json +1 -1
- package/package.json +1 -1
- package/packages/const/src/branding.ts +2 -2
- package/packages/const/src/index.ts +1 -0
- package/packages/const/src/version.ts +1 -1
- package/packages/database/src/models/topic.ts +0 -1
- package/packages/database/src/repositories/aiInfra/index.ts +19 -13
- package/packages/obervability-otel/package.json +4 -4
- package/packages/prompts/CLAUDE.md +289 -43
- package/packages/prompts/package.json +2 -1
- package/packages/prompts/promptfoo/supervisor/productive/eval.yaml +51 -0
- package/packages/prompts/promptfoo/supervisor/productive/prompt.ts +18 -0
- package/packages/prompts/promptfoo/supervisor/productive/tests/basic-case.ts +54 -0
- package/packages/prompts/promptfoo/supervisor/productive/tests/role.ts +58 -0
- package/packages/prompts/promptfoo/supervisor/productive/tools.json +80 -0
- package/packages/prompts/src/contexts/index.ts +1 -0
- package/packages/prompts/src/contexts/supervisor/index.ts +2 -0
- package/packages/prompts/src/contexts/supervisor/makeDecision.ts +68 -0
- package/packages/prompts/src/contexts/supervisor/tools.ts +102 -0
- package/packages/prompts/src/index.ts +1 -0
- package/packages/types/src/aiChat.ts +9 -3
- package/src/app/[variants]/(auth)/next-auth/signin/AuthSignInBox.tsx +4 -4
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/{OpeningQuestions.tsx → AgentWelcome/OpeningQuestions.tsx} +2 -2
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/{InboxWelcome → AgentWelcome}/index.tsx +38 -17
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/page.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/mcp/[slug]/page.tsx +1 -1
- package/src/config/modelProviders/lobehub.ts +1 -1
- package/src/locales/default/common.ts +1 -1
- package/src/locales/default/plugin.ts +1 -1
- package/src/locales/default/welcome.ts +1 -1
- package/src/server/ld.ts +1 -1
- package/src/server/routers/lambda/aiChat.ts +1 -1
- package/src/server/services/aiChat/index.test.ts +1 -1
- package/src/server/services/aiChat/index.ts +1 -1
- package/src/services/topic/client.ts +1 -1
- package/src/store/chat/slices/message/supervisor.test.ts +12 -5
- package/src/store/chat/slices/message/supervisor.ts +16 -129
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/InboxWelcome/AgentsSuggest.tsx +0 -114
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/InboxWelcome/QuestionSuggest.tsx +0 -104
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/WelcomeMessage.tsx +0 -65
- /package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/{InboxWelcome → AgentWelcome}/AddButton.tsx +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ChatCompletionTool, ChatMessage, ChatStreamPayload } from '@lobechat/types';
|
|
2
|
+
|
|
3
|
+
import { groupChatPrompts, groupSupervisorPrompts } from '../../prompts';
|
|
4
|
+
import { SupervisorToolName, SupervisorTools } from './tools';
|
|
5
|
+
|
|
6
|
+
interface SupervisorTodoItem {
|
|
7
|
+
// optional assigned owner (agent id or name)
|
|
8
|
+
assignee?: string;
|
|
9
|
+
content: string;
|
|
10
|
+
finished: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface AgentItem {
|
|
14
|
+
id: string;
|
|
15
|
+
title?: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface SupervisorContext {
|
|
18
|
+
allowDM?: boolean;
|
|
19
|
+
availableAgents: AgentItem[];
|
|
20
|
+
messages: ChatMessage[];
|
|
21
|
+
// Group scene controls which tools are exposed (e.g., todos only in 'productive')
|
|
22
|
+
scene?: 'casual' | 'productive';
|
|
23
|
+
systemPrompt?: string;
|
|
24
|
+
todoList?: SupervisorTodoItem[];
|
|
25
|
+
userName?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const contextSupervisorMakeDecision = ({
|
|
29
|
+
allowDM,
|
|
30
|
+
scene,
|
|
31
|
+
systemPrompt,
|
|
32
|
+
availableAgents,
|
|
33
|
+
todoList,
|
|
34
|
+
userName,
|
|
35
|
+
messages,
|
|
36
|
+
}: SupervisorContext) => {
|
|
37
|
+
const conversationHistory = groupSupervisorPrompts(messages);
|
|
38
|
+
const prompt = groupChatPrompts.buildSupervisorPrompt({
|
|
39
|
+
allowDM,
|
|
40
|
+
availableAgents: availableAgents.filter((agent) => agent.id),
|
|
41
|
+
conversationHistory,
|
|
42
|
+
scene,
|
|
43
|
+
systemPrompt,
|
|
44
|
+
todoList,
|
|
45
|
+
userName,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const tools = SupervisorTools.filter((tool) => {
|
|
49
|
+
if (tool.name === SupervisorToolName.trigger_agent_dm) {
|
|
50
|
+
return allowDM;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if ([SupervisorToolName.finish_todo, SupervisorToolName.create_todo].includes(tool.name)) {
|
|
54
|
+
return scene === 'productive';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return true;
|
|
58
|
+
}).map<ChatCompletionTool>((tool) => ({
|
|
59
|
+
function: tool,
|
|
60
|
+
type: 'function',
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
messages: [{ content: prompt, role: 'user' }],
|
|
65
|
+
temperature: 0.3,
|
|
66
|
+
tools,
|
|
67
|
+
} satisfies Partial<ChatStreamPayload>;
|
|
68
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { LobeUniformTool } from '@lobechat/types';
|
|
2
|
+
|
|
3
|
+
export const SupervisorToolName = {
|
|
4
|
+
create_todo: 'create_todo',
|
|
5
|
+
finish_todo: 'finish_todo',
|
|
6
|
+
trigger_agent: 'trigger_agent',
|
|
7
|
+
trigger_agent_dm: 'trigger_agent_dm',
|
|
8
|
+
wait_for_user_input: 'wait_for_user_input',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const SupervisorTools: LobeUniformTool[] = [
|
|
12
|
+
{
|
|
13
|
+
description: 'Trigger an agent to speak (group message).',
|
|
14
|
+
name: SupervisorToolName.trigger_agent,
|
|
15
|
+
parameters: {
|
|
16
|
+
properties: {
|
|
17
|
+
id: {
|
|
18
|
+
description: 'The agent id to trigger.',
|
|
19
|
+
type: 'string',
|
|
20
|
+
},
|
|
21
|
+
instruction: {
|
|
22
|
+
description:
|
|
23
|
+
'The instruction or message for the agent. No longer than 10 words. Always use English.',
|
|
24
|
+
type: 'string',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
required: ['id', 'instruction'],
|
|
28
|
+
type: 'object',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
description:
|
|
33
|
+
'Wait for user input. Use this when the conversation history looks likes fine for now, or agents are waiting for user input.',
|
|
34
|
+
name: SupervisorToolName.wait_for_user_input,
|
|
35
|
+
parameters: {
|
|
36
|
+
properties: {
|
|
37
|
+
reason: {
|
|
38
|
+
description: 'Optional reason for pausing the conversation.',
|
|
39
|
+
type: 'string',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
required: [],
|
|
43
|
+
type: 'object',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
{
|
|
48
|
+
description: 'Trigger an agent to DM another agent or user.',
|
|
49
|
+
name: SupervisorToolName.trigger_agent_dm,
|
|
50
|
+
parameters: {
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
properties: {
|
|
53
|
+
id: {
|
|
54
|
+
description: 'The agent id to trigger.',
|
|
55
|
+
type: 'string',
|
|
56
|
+
},
|
|
57
|
+
instruction: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
},
|
|
60
|
+
target: {
|
|
61
|
+
description: 'The target agent id. Only used when need DM.',
|
|
62
|
+
type: 'string',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
required: ['instruction', 'id', 'target'],
|
|
66
|
+
type: 'object',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
description: 'Create a new todo item',
|
|
71
|
+
name: SupervisorToolName.create_todo,
|
|
72
|
+
parameters: {
|
|
73
|
+
additionalProperties: false,
|
|
74
|
+
properties: {
|
|
75
|
+
assignee: {
|
|
76
|
+
description: 'Who will do the todo. Can be agent id or empty.',
|
|
77
|
+
type: 'string',
|
|
78
|
+
},
|
|
79
|
+
content: {
|
|
80
|
+
description: 'The todo content or description.',
|
|
81
|
+
type: 'string',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
required: ['content', 'assignee'],
|
|
85
|
+
type: 'object',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
description: 'Finish a todo by index or all todos',
|
|
90
|
+
name: SupervisorToolName.finish_todo,
|
|
91
|
+
parameters: {
|
|
92
|
+
additionalProperties: false,
|
|
93
|
+
properties: {
|
|
94
|
+
index: {
|
|
95
|
+
type: 'number',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
required: ['index'],
|
|
99
|
+
type: 'object',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
import { ChatMessage } from './message';
|
|
4
|
+
import { OpenAIChatMessage } from './openai/chat';
|
|
4
5
|
import { LobeUniformTool, LobeUniformToolSchema } from './tool';
|
|
5
6
|
import { ChatTopic } from './topic';
|
|
6
7
|
|
|
@@ -75,7 +76,9 @@ export const StructureOutputSchema = z.object({
|
|
|
75
76
|
provider: z.string(),
|
|
76
77
|
schema: StructureSchema.optional(),
|
|
77
78
|
systemRole: z.string().optional(),
|
|
78
|
-
tools: z
|
|
79
|
+
tools: z
|
|
80
|
+
.array(z.object({ function: LobeUniformToolSchema, type: z.literal('function') }))
|
|
81
|
+
.optional(),
|
|
79
82
|
});
|
|
80
83
|
|
|
81
84
|
interface IStructureSchema {
|
|
@@ -92,10 +95,13 @@ interface IStructureSchema {
|
|
|
92
95
|
|
|
93
96
|
export interface StructureOutputParams {
|
|
94
97
|
keyVaultsPayload: string;
|
|
95
|
-
messages:
|
|
98
|
+
messages: OpenAIChatMessage[];
|
|
96
99
|
model: string;
|
|
97
100
|
provider: string;
|
|
98
101
|
schema?: IStructureSchema;
|
|
99
102
|
systemRole?: string;
|
|
100
|
-
tools?:
|
|
103
|
+
tools?: {
|
|
104
|
+
function: LobeUniformTool;
|
|
105
|
+
type: 'function';
|
|
106
|
+
}[];
|
|
101
107
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { BRANDING_NAME, DOCUMENTS_REFER_URL, PRIVACY_URL, TERMS_URL } from '@lobechat/const';
|
|
3
4
|
import { Button, Text } from '@lobehub/ui';
|
|
4
|
-
import {
|
|
5
|
+
import { LobeHub } from '@lobehub/ui/brand';
|
|
5
6
|
import { Col, Flex, Row, Skeleton } from 'antd';
|
|
6
7
|
import { createStyles } from 'antd-style';
|
|
7
8
|
import { AuthError } from 'next-auth';
|
|
@@ -12,7 +13,6 @@ import { useTranslation } from 'react-i18next';
|
|
|
12
13
|
|
|
13
14
|
import BrandWatermark from '@/components/BrandWatermark';
|
|
14
15
|
import AuthIcons from '@/components/NextAuth/AuthIcons';
|
|
15
|
-
import { DOCUMENTS_REFER_URL, PRIVACY_URL, TERMS_URL } from '@/const/url';
|
|
16
16
|
import { useUserStore } from '@/store/user';
|
|
17
17
|
|
|
18
18
|
const useStyles = createStyles(({ css, token }) => ({
|
|
@@ -114,9 +114,9 @@ export default memo(() => {
|
|
|
114
114
|
<div className={styles.text}>
|
|
115
115
|
<Text as={'h4'} className={styles.title}>
|
|
116
116
|
<div>
|
|
117
|
-
<
|
|
117
|
+
<LobeHub size={48} />
|
|
118
118
|
</div>
|
|
119
|
-
{t('signIn.start.title', { applicationName:
|
|
119
|
+
{t('signIn.start.title', { applicationName: BRANDING_NAME })}
|
|
120
120
|
</Text>
|
|
121
121
|
<Text as={'p'} className={styles.description}>
|
|
122
122
|
{t('signIn.start.subtitle')}
|
|
@@ -8,7 +8,7 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
8
8
|
|
|
9
9
|
import { useChatStore } from '@/store/chat';
|
|
10
10
|
|
|
11
|
-
import { useSend } from '
|
|
11
|
+
import { useSend } from '../../../ChatInput/useSend';
|
|
12
12
|
|
|
13
13
|
const useStyles = createStyles(({ css, token, responsive }) => ({
|
|
14
14
|
card: css`
|
|
@@ -25,7 +25,7 @@ const useStyles = createStyles(({ css, token, responsive }) => ({
|
|
|
25
25
|
|
|
26
26
|
container: css`
|
|
27
27
|
padding-block: 0;
|
|
28
|
-
padding-inline:
|
|
28
|
+
padding-inline: 0;
|
|
29
29
|
`,
|
|
30
30
|
|
|
31
31
|
title: css`
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { BRANDING_NAME } from '@lobechat/const';
|
|
3
4
|
import { FluentEmoji, Markdown } from '@lobehub/ui';
|
|
4
5
|
import { createStyles } from 'antd-style';
|
|
5
|
-
import
|
|
6
|
+
import isEqual from 'fast-deep-equal';
|
|
7
|
+
import React, { memo, useMemo } from 'react';
|
|
6
8
|
import { Trans, useTranslation } from 'react-i18next';
|
|
7
9
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
8
10
|
|
|
9
|
-
import { BRANDING_NAME } from '@/const/branding';
|
|
10
|
-
import { isCustomBranding } from '@/const/version';
|
|
11
11
|
import { useGreeting } from '@/hooks/useGreeting';
|
|
12
|
+
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
13
|
+
import { useAgentStore } from '@/store/agent';
|
|
14
|
+
import { agentSelectors } from '@/store/agent/selectors';
|
|
15
|
+
import { useChatStore } from '@/store/chat';
|
|
16
|
+
import { chatSelectors } from '@/store/chat/selectors';
|
|
12
17
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
18
|
+
import { useSessionStore } from '@/store/session';
|
|
19
|
+
import { sessionMetaSelectors } from '@/store/session/selectors';
|
|
13
20
|
|
|
14
21
|
import AddButton from './AddButton';
|
|
15
|
-
import
|
|
16
|
-
import QuestionSuggest from './QuestionSuggest';
|
|
22
|
+
import OpeningQuestions from './OpeningQuestions';
|
|
17
23
|
|
|
18
24
|
const useStyles = createStyles(({ css, responsive }) => ({
|
|
19
25
|
container: css`
|
|
@@ -41,14 +47,30 @@ const useStyles = createStyles(({ css, responsive }) => ({
|
|
|
41
47
|
}));
|
|
42
48
|
|
|
43
49
|
const InboxWelcome = memo(() => {
|
|
44
|
-
const { t } = useTranslation('welcome');
|
|
50
|
+
const { t } = useTranslation(['welcome', 'chat']);
|
|
45
51
|
const { styles } = useStyles();
|
|
46
|
-
const mobile =
|
|
52
|
+
const mobile = useIsMobile();
|
|
47
53
|
const greeting = useGreeting();
|
|
48
|
-
const {
|
|
54
|
+
const { showCreateSession } = useServerConfigStore(featureFlagsSelectors);
|
|
55
|
+
const openingQuestions = useAgentStore(agentSelectors.openingQuestions);
|
|
56
|
+
|
|
57
|
+
const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
|
|
58
|
+
|
|
59
|
+
const agentSystemRoleMsg = t('agentDefaultMessageWithSystemRole', {
|
|
60
|
+
name: meta.title || t('defaultAgent', { ns: 'chat' }),
|
|
61
|
+
ns: 'chat',
|
|
62
|
+
});
|
|
63
|
+
const openingMessage = useAgentStore(agentSelectors.openingMessage);
|
|
64
|
+
|
|
65
|
+
const showInboxWelcome = useChatStore(chatSelectors.showInboxWelcome);
|
|
66
|
+
|
|
67
|
+
const message = useMemo(() => {
|
|
68
|
+
if (openingMessage) return openingMessage;
|
|
69
|
+
return agentSystemRoleMsg;
|
|
70
|
+
}, [openingMessage, agentSystemRoleMsg, meta.description]);
|
|
49
71
|
|
|
50
72
|
return (
|
|
51
|
-
<Center padding={16} width={'100%'}>
|
|
73
|
+
<Center gap={12} padding={16} width={'100%'}>
|
|
52
74
|
<Flexbox className={styles.container} gap={16} style={{ maxWidth: 800 }} width={'100%'}>
|
|
53
75
|
<Flexbox align={'center'} gap={8} horizontal>
|
|
54
76
|
<FluentEmoji emoji={'👋'} size={40} type={'anim'} />
|
|
@@ -74,15 +96,14 @@ const InboxWelcome = memo(() => {
|
|
|
74
96
|
}}
|
|
75
97
|
variant={'chat'}
|
|
76
98
|
>
|
|
77
|
-
{
|
|
78
|
-
|
|
79
|
-
|
|
99
|
+
{showInboxWelcome
|
|
100
|
+
? t(showCreateSession ? 'guide.defaultMessage' : 'guide.defaultMessageWithoutCreate', {
|
|
101
|
+
appName: BRANDING_NAME,
|
|
102
|
+
})
|
|
103
|
+
: message}
|
|
80
104
|
</Markdown>
|
|
81
|
-
{
|
|
82
|
-
|
|
83
|
-
<AgentsSuggest mobile={mobile} />
|
|
84
|
-
{!isCustomBranding && <QuestionSuggest mobile={mobile} />}
|
|
85
|
-
</>
|
|
105
|
+
{openingQuestions.length > 0 && (
|
|
106
|
+
<OpeningQuestions mobile={mobile} questions={openingQuestions} />
|
|
86
107
|
)}
|
|
87
108
|
</Flexbox>
|
|
88
109
|
</Center>
|
|
@@ -3,15 +3,15 @@ import React, { memo } from 'react';
|
|
|
3
3
|
import { sessionSelectors } from '@/store/session/selectors';
|
|
4
4
|
import { useSessionStore } from '@/store/session/store';
|
|
5
5
|
|
|
6
|
+
import AgentWelcome from './AgentWelcome';
|
|
6
7
|
import GroupWelcome from './GroupWelcome';
|
|
7
|
-
import WelcomeMessage from './WelcomeMessage';
|
|
8
8
|
|
|
9
9
|
const WelcomeChatItem = memo(() => {
|
|
10
10
|
const isGroupSession = useSessionStore(sessionSelectors.isCurrentSessionGroupSession);
|
|
11
11
|
|
|
12
12
|
if (isGroupSession) return <GroupWelcome />;
|
|
13
13
|
|
|
14
|
-
return <
|
|
14
|
+
return <AgentWelcome />;
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
export default WelcomeChatItem;
|
|
@@ -48,7 +48,7 @@ export const generateMetadata = async (props: DiscoverPageProps) => {
|
|
|
48
48
|
authors: [
|
|
49
49
|
{ name: author, url: homepage },
|
|
50
50
|
{ name: 'LobeHub', url: 'https://github.com/lobehub' },
|
|
51
|
-
{ name: '
|
|
51
|
+
{ name: 'LobeHub Cloud', url: 'https://lobehub.com' },
|
|
52
52
|
],
|
|
53
53
|
keywords: tags,
|
|
54
54
|
...metadataModule.generate({
|
|
@@ -42,7 +42,7 @@ export const generateMetadata = async (props: DiscoverPageProps) => {
|
|
|
42
42
|
authors: [
|
|
43
43
|
{ name: author, url: homepage },
|
|
44
44
|
{ name: 'LobeHub', url: 'https://github.com/lobehub' },
|
|
45
|
-
{ name: '
|
|
45
|
+
{ name: 'LobeHub Cloud', url: 'https://lobehub,com' },
|
|
46
46
|
],
|
|
47
47
|
keywords: tags,
|
|
48
48
|
...metadataModule.generate({
|
|
@@ -3,7 +3,7 @@ import { ModelProviderCard } from '@/types/llm';
|
|
|
3
3
|
const LobeHub: ModelProviderCard = {
|
|
4
4
|
chatModels: [],
|
|
5
5
|
description:
|
|
6
|
-
'
|
|
6
|
+
'LobeHub Cloud 通过官方部署的 API 来实现 AI 模型的调用,并采用 Credits 计算积分的方式来衡量 AI 模型的用量,对应大模型使用的 Tokens。',
|
|
7
7
|
enabled: true,
|
|
8
8
|
id: 'lobehub',
|
|
9
9
|
modelsUrl: 'https://lobehub.com/zh/docs/usage/subscription/model-pricing',
|
|
@@ -33,7 +33,7 @@ export default {
|
|
|
33
33
|
blog: '产品博客',
|
|
34
34
|
branching: '创建子话题',
|
|
35
35
|
branchingDisable:
|
|
36
|
-
'「子话题」功能在当前模式下不可用,如需该功能,请切换到 Postgres/Pglite DB 模式或使用
|
|
36
|
+
'「子话题」功能在当前模式下不可用,如需该功能,请切换到 Postgres/Pglite DB 模式或使用 LobeHub Cloud',
|
|
37
37
|
branchingRequiresSavedTopic: '当前话题未保存,保存后才可以使用子话题能力',
|
|
38
38
|
cancel: '取消',
|
|
39
39
|
changelog: '更新日志',
|
package/src/server/ld.ts
CHANGED
|
@@ -87,7 +87,7 @@ export class Ld {
|
|
|
87
87
|
return {
|
|
88
88
|
'@id': this.getId(OFFICIAL_URL, '#organization'),
|
|
89
89
|
'@type': 'Organization',
|
|
90
|
-
'alternateName': '
|
|
90
|
+
'alternateName': 'LobeHub',
|
|
91
91
|
'contactPoint': {
|
|
92
92
|
'@type': 'ContactPoint',
|
|
93
93
|
'contactType': 'customer support',
|
|
@@ -32,7 +32,7 @@ describe('AiChatService', () => {
|
|
|
32
32
|
{ includeTopic: true, sessionId: 's1' },
|
|
33
33
|
expect.objectContaining({ postProcessUrl: expect.any(Function) }),
|
|
34
34
|
);
|
|
35
|
-
expect(mockQueryTopics).toHaveBeenCalledWith({
|
|
35
|
+
expect(mockQueryTopics).toHaveBeenCalledWith({ containerId: 's1' });
|
|
36
36
|
expect(res.messages).toEqual([{ id: 'm1' }]);
|
|
37
37
|
expect(res.topics).toEqual([{ id: 't1' }]);
|
|
38
38
|
});
|
|
@@ -29,7 +29,7 @@ export class AiChatService {
|
|
|
29
29
|
this.messageModel.query(params, {
|
|
30
30
|
postProcessUrl: (path) => this.fileService.getFullFileUrl(path),
|
|
31
31
|
}),
|
|
32
|
-
params.includeTopic ? this.topicModel.query({
|
|
32
|
+
params.includeTopic ? this.topicModel.query({ containerId: params.sessionId }) : undefined,
|
|
33
33
|
]);
|
|
34
34
|
|
|
35
35
|
return { messages, topics };
|
|
@@ -38,7 +38,7 @@ export class ClientService extends BaseClientService implements ITopicService {
|
|
|
38
38
|
getTopics: ITopicService['getTopics'] = async (params) => {
|
|
39
39
|
const data = await this.topicModel.query({
|
|
40
40
|
...params,
|
|
41
|
-
|
|
41
|
+
containerId: this.toDbSessionId(params.containerId),
|
|
42
42
|
});
|
|
43
43
|
return data as unknown as Promise<ChatTopic[]>;
|
|
44
44
|
};
|
|
@@ -5,10 +5,17 @@ import { aiChatService } from '@/services/aiChat';
|
|
|
5
5
|
import { GroupChatSupervisor, type SupervisorContext } from './supervisor';
|
|
6
6
|
|
|
7
7
|
vi.mock('@lobechat/prompts', () => ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
contextSupervisorMakeDecision: vi.fn(() => ({
|
|
9
|
+
messages: [{ content: 'structured-supervisor-prompt', role: 'user' }],
|
|
10
|
+
temperature: 0.3,
|
|
11
|
+
tools: [
|
|
12
|
+
{ function: { name: 'trigger_agent' }, type: 'function' },
|
|
13
|
+
{ function: { name: 'wait_for_user_input' }, type: 'function' },
|
|
14
|
+
{ function: { name: 'trigger_agent_dm' }, type: 'function' },
|
|
15
|
+
{ function: { name: 'create_todo' }, type: 'function' },
|
|
16
|
+
{ function: { name: 'finish_todo' }, type: 'function' },
|
|
17
|
+
],
|
|
18
|
+
})),
|
|
12
19
|
}));
|
|
13
20
|
|
|
14
21
|
vi.mock('@/services/aiChat', () => ({
|
|
@@ -76,7 +83,7 @@ describe('GroupChatSupervisor', () => {
|
|
|
76
83
|
temperature: 0.3,
|
|
77
84
|
});
|
|
78
85
|
|
|
79
|
-
const toolNames = (payload.tools ?? []).map((tool: any) => tool.name);
|
|
86
|
+
const toolNames = (payload.tools ?? []).map((tool: any) => tool.function.name);
|
|
80
87
|
expect(toolNames).toEqual(
|
|
81
88
|
expect.arrayContaining([
|
|
82
89
|
'trigger_agent',
|