@lobehub/lobehub 2.0.0-next.310 → 2.0.0-next.312
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/.github/PULL_REQUEST_TEMPLATE.md +1 -1
- package/CHANGELOG.md +58 -0
- package/changelog/v1.json +21 -0
- package/docs/development/basic/chat-api.mdx +0 -1
- package/docs/development/basic/chat-api.zh-CN.mdx +0 -1
- package/e2e/README.md +1 -1
- package/e2e/src/features/community/detail-pages.feature +2 -2
- package/e2e/src/features/community/interactions.feature +5 -5
- package/e2e/src/features/community/smoke.feature +1 -1
- package/e2e/src/steps/community/detail-pages.steps.ts +6 -4
- package/e2e/src/steps/community/interactions.steps.ts +3 -3
- package/package.json +1 -1
- package/packages/builtin-tool-agent-builder/src/systemRole.ts +9 -0
- package/packages/model-runtime/src/core/BaseAI.ts +0 -2
- package/packages/model-runtime/src/core/ModelRuntime.test.ts +0 -37
- package/packages/model-runtime/src/core/ModelRuntime.ts +0 -5
- package/packages/model-runtime/src/core/RouterRuntime/baseRuntimeMap.ts +4 -0
- package/packages/model-runtime/src/core/RouterRuntime/createRuntime.test.ts +325 -200
- package/packages/model-runtime/src/core/RouterRuntime/createRuntime.ts +205 -64
- package/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts +0 -14
- package/packages/model-runtime/src/providers/aihubmix/index.test.ts +14 -20
- package/packages/model-runtime/src/types/index.ts +0 -1
- package/packages/model-runtime/src/utils/createError.test.ts +0 -20
- package/packages/model-runtime/src/utils/createError.ts +0 -1
- package/public/favicon-32x-32-error.ico +0 -0
- package/public/favicon-32x32-done-dev.ico +0 -0
- package/public/favicon-32x32-done.ico +0 -0
- package/public/favicon-32x32-error-dev.ico +0 -0
- package/public/favicon-32x32-progress-dev.ico +0 -0
- package/public/favicon-32x32-progress.ico +0 -0
- package/public/favicon-done-dev.ico +0 -0
- package/public/favicon-done.ico +0 -0
- package/public/favicon-error-dev.ico +0 -0
- package/public/favicon-error.ico +0 -0
- package/public/favicon-progress-dev.ico +0 -0
- package/public/favicon-progress.ico +0 -0
- package/src/app/(backend)/market/agent/[[...segments]]/route.ts +3 -33
- package/src/app/(backend)/market/oidc/[[...segments]]/route.ts +5 -6
- package/src/app/(backend)/market/social/[[...segments]]/route.ts +5 -52
- package/src/app/(backend)/market/user/[username]/route.ts +3 -9
- package/src/app/(backend)/market/user/me/route.ts +3 -34
- package/src/app/[variants]/(main)/agent/profile/features/Header/AgentPublishButton/PublishResultModal.tsx +1 -1
- package/src/app/[variants]/(main)/community/(detail)/_layout/Header.tsx +15 -3
- package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Overview/TagList.tsx +1 -1
- package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Related/index.tsx +2 -2
- package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/SystemRole/TagList.tsx +1 -1
- package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/SystemRole/index.tsx +1 -1
- package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Header.tsx +2 -2
- package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Sidebar/ActionButton/AddAgent.tsx +1 -1
- package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Sidebar/ActionButton/index.tsx +1 -1
- package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Sidebar/Related/index.tsx +2 -2
- package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/StatusPage/index.tsx +2 -2
- package/src/app/[variants]/(main)/community/(detail)/user/features/UserAgentCard.tsx +2 -2
- package/src/app/[variants]/(main)/community/(detail)/user/features/UserFavoriteAgents.tsx +1 -1
- package/src/app/[variants]/(main)/community/(list)/(home)/index.tsx +2 -2
- package/src/app/[variants]/(main)/community/(list)/(home)/loading.tsx +1 -1
- package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/Client.tsx +5 -1
- package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/features/Category/index.tsx +1 -1
- package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/features/List/Item.tsx +1 -1
- package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/features/MarketSourceSwitch.tsx +1 -1
- package/src/app/[variants]/(main)/community/_layout/Sidebar/Header/Nav.tsx +2 -2
- package/src/app/[variants]/(main)/home/features/CommunityAgents/List.tsx +1 -1
- package/src/app/[variants]/(main)/home/features/CommunityAgents/index.tsx +1 -1
- package/src/app/[variants]/(mobile)/_layout/index.tsx +1 -1
- package/src/app/[variants]/(mobile)/router/mobileRouter.config.tsx +6 -6
- package/src/app/[variants]/router/desktopRouter.config.tsx +8 -8
- package/src/app/[variants]/share/t/[id]/_layout/index.tsx +1 -1
- package/src/features/ChatMiniMap/useMinimapData.ts +1 -1
- package/src/features/CommandMenu/SearchResults.tsx +1 -1
- package/src/features/Conversation/ChatList/components/VirtualizedList.tsx +20 -2
- package/src/features/Conversation/store/slices/virtuaList/action.ts +9 -0
- package/src/features/Electron/navigation/routeMetadata.ts +1 -1
- package/src/layout/GlobalProvider/FaviconProvider.tsx +92 -0
- package/src/layout/GlobalProvider/index.tsx +15 -11
- package/src/libs/next/config/define-config.ts +1 -1
- package/src/libs/trpc/lambda/middleware/marketSDK.ts +14 -23
- package/src/libs/trusted-client/index.ts +1 -1
- package/src/server/routers/lambda/market/index.ts +5 -0
- package/src/server/routers/lambda/market/oidc.ts +41 -61
- package/src/server/routers/tools/market.ts +12 -44
- package/src/server/services/agentRuntime/AgentRuntimeService.test.ts +7 -0
- package/src/server/services/agentRuntime/AgentRuntimeService.ts +1 -1
- package/src/server/services/aiAgent/__tests__/execAgent.threadId.test.ts +7 -0
- package/src/server/services/aiAgent/__tests__/execGroupSubAgentTask.test.ts +7 -0
- package/src/server/services/aiAgent/index.ts +9 -96
- package/src/server/services/discover/index.ts +11 -16
- package/src/server/services/market/index.ts +485 -0
- package/src/server/services/toolExecution/builtin.ts +11 -17
- package/src/server/services/toolExecution/index.ts +6 -2
- package/src/server/sitemap.test.ts +5 -5
- package/src/server/sitemap.ts +3 -3
- package/src/services/codeInterpreter.ts +0 -13
- package/packages/model-runtime/src/types/textToImage.ts +0 -36
- package/src/server/services/lobehubSkill/index.ts +0 -109
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/DetailProvider.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Capabilities/Block.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Capabilities/Knowledge.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Capabilities/KnowledgeItem.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Capabilities/PluginItem.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Capabilities/Plugins.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Capabilities/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Nav.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Overview/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Versions/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Sidebar/Related/Item.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Sidebar/Summary/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Sidebar/TocList/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Sidebar/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/loading.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/_layout/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/_layout/style.ts +0 -0
- /package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/features/Category/useCategory.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/features/List/TokenTag.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/features/List/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/index.tsx +0 -0
- /package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/loading.tsx +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { WebBrowsingManifest } from '@lobechat/builtin-tool-web-browsing';
|
|
2
2
|
import { WebBrowsingExecutionRuntime } from '@lobechat/builtin-tool-web-browsing/executionRuntime';
|
|
3
|
+
import { type LobeChatDatabase } from '@lobechat/database';
|
|
3
4
|
import { type ChatToolPayload } from '@lobechat/types';
|
|
4
5
|
import { safeParseJSON } from '@lobechat/utils';
|
|
5
6
|
import debug from 'debug';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
+
import { MarketService } from '@/server/services/market';
|
|
8
9
|
import { SearchService } from '@/server/services/search';
|
|
9
10
|
|
|
10
|
-
import { type IToolExecutor, type
|
|
11
|
+
import { type IToolExecutor, type ToolExecutionResult } from './types';
|
|
11
12
|
|
|
12
13
|
const log = debug('lobe-server:builtin-tools-executor');
|
|
13
14
|
|
|
@@ -16,10 +17,12 @@ const BuiltinToolServerRuntimes: Record<string, any> = {
|
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export class BuiltinToolsExecutor implements IToolExecutor {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
private marketService: MarketService;
|
|
21
|
+
|
|
22
|
+
constructor(db: LobeChatDatabase, userId: string) {
|
|
23
|
+
this.marketService = new MarketService({ userInfo: { userId } });
|
|
24
|
+
}
|
|
25
|
+
async execute(payload: ChatToolPayload): Promise<ToolExecutionResult> {
|
|
23
26
|
const { identifier, apiName, arguments: argsStr, source } = payload;
|
|
24
27
|
const args = safeParseJSON(argsStr) || {};
|
|
25
28
|
|
|
@@ -31,18 +34,9 @@ export class BuiltinToolsExecutor implements IToolExecutor {
|
|
|
31
34
|
args,
|
|
32
35
|
);
|
|
33
36
|
|
|
34
|
-
// Route LobeHub Skills to
|
|
37
|
+
// Route LobeHub Skills to MarketService
|
|
35
38
|
if (source === 'lobehubSkill') {
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
content: 'Server context not available for LobeHub Skills execution.',
|
|
39
|
-
error: { code: 'CONTEXT_NOT_AVAILABLE' },
|
|
40
|
-
success: false,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const skillService = new LobehubSkillService(context.serverDB, context.userId);
|
|
45
|
-
return skillService.execute({
|
|
39
|
+
return this.marketService.executeLobehubSkill({
|
|
46
40
|
args,
|
|
47
41
|
provider: identifier,
|
|
48
42
|
toolName: apiName,
|
|
@@ -4,7 +4,11 @@ import debug from 'debug';
|
|
|
4
4
|
import { type MCPService } from '../mcp';
|
|
5
5
|
import { type PluginGatewayService } from '../pluginGateway';
|
|
6
6
|
import { type BuiltinToolsExecutor } from './builtin';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
type ToolExecutionContext,
|
|
9
|
+
type ToolExecutionResult,
|
|
10
|
+
type ToolExecutionResultResponse,
|
|
11
|
+
} from './types';
|
|
8
12
|
|
|
9
13
|
const log = debug('lobe-server:tool-execution-service');
|
|
10
14
|
|
|
@@ -43,7 +47,7 @@ export class ToolExecutionService {
|
|
|
43
47
|
let data: ToolExecutionResult;
|
|
44
48
|
switch (typeStr) {
|
|
45
49
|
case 'builtin': {
|
|
46
|
-
data = await this.builtinToolsExecutor.execute(payload
|
|
50
|
+
data = await this.builtinToolsExecutor.execute(payload);
|
|
47
51
|
break;
|
|
48
52
|
}
|
|
49
53
|
|
|
@@ -59,7 +59,7 @@ describe('Sitemap', () => {
|
|
|
59
59
|
);
|
|
60
60
|
expect(pageSitemap).toContainEqual(
|
|
61
61
|
expect.objectContaining({
|
|
62
|
-
url: getCanonicalUrl('/community/
|
|
62
|
+
url: getCanonicalUrl('/community/agent'),
|
|
63
63
|
changeFrequency: 'daily',
|
|
64
64
|
priority: 0.7,
|
|
65
65
|
}),
|
|
@@ -85,13 +85,13 @@ describe('Sitemap', () => {
|
|
|
85
85
|
expect(assistantsSitemap.length).toBe(LOCALE_COUNT);
|
|
86
86
|
expect(assistantsSitemap).toContainEqual(
|
|
87
87
|
expect.objectContaining({
|
|
88
|
-
url: getCanonicalUrl('/community/
|
|
88
|
+
url: getCanonicalUrl('/community/agent/test-assistant'),
|
|
89
89
|
lastModified: '2023-01-01T00:00:00.000Z',
|
|
90
90
|
}),
|
|
91
91
|
);
|
|
92
92
|
expect(assistantsSitemap).toContainEqual(
|
|
93
93
|
expect.objectContaining({
|
|
94
|
-
url: getCanonicalUrl('/community/
|
|
94
|
+
url: getCanonicalUrl('/community/agent/test-assistant?hl=zh-CN'),
|
|
95
95
|
lastModified: '2023-01-01T00:00:00.000Z',
|
|
96
96
|
}),
|
|
97
97
|
);
|
|
@@ -113,7 +113,7 @@ describe('Sitemap', () => {
|
|
|
113
113
|
expect(firstPageSitemap.length).toBe(100 * LOCALE_COUNT); // 100 items * LOCALE_COUNT locales
|
|
114
114
|
expect(firstPageSitemap).toContainEqual(
|
|
115
115
|
expect.objectContaining({
|
|
116
|
-
url: getCanonicalUrl('/community/
|
|
116
|
+
url: getCanonicalUrl('/community/agent/test-assistant-0'),
|
|
117
117
|
lastModified: '2023-01-01T00:00:00.000Z',
|
|
118
118
|
}),
|
|
119
119
|
);
|
|
@@ -123,7 +123,7 @@ describe('Sitemap', () => {
|
|
|
123
123
|
expect(secondPageSitemap.length).toBe(50 * LOCALE_COUNT); // 50 items * LOCALE_COUNT locales
|
|
124
124
|
expect(secondPageSitemap).toContainEqual(
|
|
125
125
|
expect.objectContaining({
|
|
126
|
-
url: getCanonicalUrl('/community/
|
|
126
|
+
url: getCanonicalUrl('/community/agent/test-assistant-100'),
|
|
127
127
|
lastModified: '2023-01-01T00:00:00.000Z',
|
|
128
128
|
}),
|
|
129
129
|
);
|
package/src/server/sitemap.ts
CHANGED
|
@@ -213,7 +213,7 @@ export class Sitemap {
|
|
|
213
213
|
const sitmap = pageAssistants
|
|
214
214
|
.filter((item) => item.identifier) // Filter out items with empty identifiers
|
|
215
215
|
.map((item) =>
|
|
216
|
-
this._genSitemap(urlJoin('/community/
|
|
216
|
+
this._genSitemap(urlJoin('/community/agent', item.identifier), {
|
|
217
217
|
lastModified: item?.lastModified || LAST_MODIFIED,
|
|
218
218
|
}),
|
|
219
219
|
);
|
|
@@ -224,7 +224,7 @@ export class Sitemap {
|
|
|
224
224
|
const sitmap = list
|
|
225
225
|
.filter((item) => item.identifier) // 过滤掉 identifier 为空的项目
|
|
226
226
|
.map((item) =>
|
|
227
|
-
this._genSitemap(urlJoin('/community/
|
|
227
|
+
this._genSitemap(urlJoin('/community/agent', item.identifier), {
|
|
228
228
|
lastModified: item?.lastModified || LAST_MODIFIED,
|
|
229
229
|
}),
|
|
230
230
|
);
|
|
@@ -311,7 +311,7 @@ export class Sitemap {
|
|
|
311
311
|
|
|
312
312
|
/* ↑ cloud slot ↑ */
|
|
313
313
|
...this._genSitemap('/community', { changeFrequency: 'daily', priority: 0.7 }),
|
|
314
|
-
...this._genSitemap('/community/
|
|
314
|
+
...this._genSitemap('/community/agent', { changeFrequency: 'daily', priority: 0.7 }),
|
|
315
315
|
...this._genSitemap('/community/mcp', { changeFrequency: 'daily', priority: 0.7 }),
|
|
316
316
|
...this._genSitemap('/community/plugin', { changeFrequency: 'daily', priority: 0.7 }),
|
|
317
317
|
...this._genSitemap('/community/model', { changeFrequency: 'daily', priority: 0.7 }),
|
|
@@ -5,16 +5,6 @@ import type {
|
|
|
5
5
|
ExportAndUploadFileInput,
|
|
6
6
|
ExportAndUploadFileResult,
|
|
7
7
|
} from '@/server/routers/tools/market';
|
|
8
|
-
import { useUserStore } from '@/store/user';
|
|
9
|
-
import { settingsSelectors } from '@/store/user/slices/settings/selectors/settings';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Get Market access token from user settings (stored by MarketAuthProvider)
|
|
13
|
-
*/
|
|
14
|
-
const getMarketAccessToken = (): string | undefined => {
|
|
15
|
-
const settings = settingsSelectors.currentSettings(useUserStore.getState());
|
|
16
|
-
return settings.market?.accessToken;
|
|
17
|
-
};
|
|
18
8
|
|
|
19
9
|
class CodeInterpreterService {
|
|
20
10
|
/**
|
|
@@ -28,10 +18,7 @@ class CodeInterpreterService {
|
|
|
28
18
|
params: Record<string, any>,
|
|
29
19
|
context: { topicId: string; userId: string },
|
|
30
20
|
): Promise<CallToolResult> {
|
|
31
|
-
const marketAccessToken = getMarketAccessToken();
|
|
32
|
-
|
|
33
21
|
const input: CallCodeInterpreterToolInput = {
|
|
34
|
-
marketAccessToken,
|
|
35
22
|
params,
|
|
36
23
|
toolName,
|
|
37
24
|
topicId: context.topicId,
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export type DallEImageQuality = 'standard' | 'hd';
|
|
2
|
-
export type DallEImageStyle = 'vivid' | 'natural';
|
|
3
|
-
export type DallEImageSize = '1792x1024' | '1024x1024' | '1024x1792';
|
|
4
|
-
|
|
5
|
-
export interface TextToImagePayload {
|
|
6
|
-
model: string;
|
|
7
|
-
/**
|
|
8
|
-
* The number of images to generate. Must be between 1 and 10.
|
|
9
|
-
*/
|
|
10
|
-
n?: number;
|
|
11
|
-
/**
|
|
12
|
-
* A text description of the desired image(s).
|
|
13
|
-
* The maximum length is 1000 characters.
|
|
14
|
-
*/
|
|
15
|
-
prompt: string;
|
|
16
|
-
/**
|
|
17
|
-
* The quality of the image that will be generated.
|
|
18
|
-
* hd creates images with finer details and greater consistency across the image.
|
|
19
|
-
* This param is only supported for dall-e-3.
|
|
20
|
-
*/
|
|
21
|
-
quality?: DallEImageQuality;
|
|
22
|
-
/**
|
|
23
|
-
* The size of the generated images.
|
|
24
|
-
* Must be one of '1792x1024' , '1024x1024' , '1024x1792'
|
|
25
|
-
*/
|
|
26
|
-
size?: DallEImageSize;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The style of the generated images. Must be one of vivid or natural.
|
|
30
|
-
* Vivid causes the model to lean towards generating hyper-real and dramatic images.
|
|
31
|
-
* Natural causes the model to produce more natural, less hyper-real looking images.
|
|
32
|
-
* This param is only supported for dall-e-3.
|
|
33
|
-
* @default vivid
|
|
34
|
-
*/
|
|
35
|
-
style?: DallEImageStyle;
|
|
36
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { type LobeChatDatabase } from '@lobechat/database';
|
|
2
|
-
import { MarketSDK } from '@lobehub/market-sdk';
|
|
3
|
-
import debug from 'debug';
|
|
4
|
-
|
|
5
|
-
import { UserModel } from '@/database/models/user';
|
|
6
|
-
import { generateTrustedClientToken } from '@/libs/trusted-client';
|
|
7
|
-
|
|
8
|
-
const log = debug('lobe-server:lobehub-skill-service');
|
|
9
|
-
|
|
10
|
-
export interface LobehubSkillExecuteParams {
|
|
11
|
-
args: Record<string, any>;
|
|
12
|
-
provider: string;
|
|
13
|
-
toolName: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface LobehubSkillExecuteResult {
|
|
17
|
-
content: string;
|
|
18
|
-
error?: { code: string; message?: string };
|
|
19
|
-
success: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class LobehubSkillService {
|
|
23
|
-
private db: LobeChatDatabase;
|
|
24
|
-
private userId: string;
|
|
25
|
-
private marketSDK?: MarketSDK;
|
|
26
|
-
|
|
27
|
-
constructor(db: LobeChatDatabase, userId: string) {
|
|
28
|
-
this.db = db;
|
|
29
|
-
this.userId = userId;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Initialize MarketSDK with trusted client token
|
|
34
|
-
*/
|
|
35
|
-
private async getMarketSDK(): Promise<MarketSDK | null> {
|
|
36
|
-
if (this.marketSDK) return this.marketSDK;
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
const user = await UserModel.findById(this.db, this.userId);
|
|
40
|
-
if (!user?.email) {
|
|
41
|
-
log('getMarketSDK: user email not found');
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const trustedClientToken = generateTrustedClientToken({
|
|
46
|
-
email: user.email,
|
|
47
|
-
name: user.fullName || user.firstName || undefined,
|
|
48
|
-
userId: this.userId,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
if (!trustedClientToken) {
|
|
52
|
-
log('getMarketSDK: trusted client not configured');
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
this.marketSDK = new MarketSDK({
|
|
57
|
-
baseURL: process.env.NEXT_PUBLIC_MARKET_BASE_URL,
|
|
58
|
-
trustedClientToken,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
return this.marketSDK;
|
|
62
|
-
} catch (error) {
|
|
63
|
-
log('getMarketSDK: error creating SDK: %O', error);
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Execute a LobeHub Skill tool
|
|
70
|
-
*/
|
|
71
|
-
async execute(params: LobehubSkillExecuteParams): Promise<LobehubSkillExecuteResult> {
|
|
72
|
-
const { provider, toolName, args } = params;
|
|
73
|
-
|
|
74
|
-
log('execute: %s/%s with args: %O', provider, toolName, args);
|
|
75
|
-
|
|
76
|
-
const sdk = await this.getMarketSDK();
|
|
77
|
-
if (!sdk) {
|
|
78
|
-
return {
|
|
79
|
-
content:
|
|
80
|
-
'MarketSDK not available. Please ensure you are authenticated with LobeHub Market.',
|
|
81
|
-
error: { code: 'MARKET_SDK_NOT_AVAILABLE' },
|
|
82
|
-
success: false,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
const response = await sdk.skills.callTool(provider, {
|
|
88
|
-
args,
|
|
89
|
-
tool: toolName,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
log('execute: response: %O', response);
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
content: typeof response.data === 'string' ? response.data : JSON.stringify(response.data),
|
|
96
|
-
success: response.success,
|
|
97
|
-
};
|
|
98
|
-
} catch (error) {
|
|
99
|
-
const err = error as Error;
|
|
100
|
-
console.error('LobehubSkillService.execute error %s/%s: %O', provider, toolName, err);
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
content: err.message,
|
|
104
|
-
error: { code: 'LOBEHUB_SKILL_ERROR', message: err.message },
|
|
105
|
-
success: false,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/Nav.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Details/index.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/app/[variants]/(main)/community/(detail)/{assistant → agent}/features/Sidebar/index.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/features/List/TokenTag.tsx
RENAMED
|
File without changes
|
/package/src/app/[variants]/(main)/community/(list)/{assistant → agent}/features/List/index.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|