@lobehub/lobehub 2.0.0-next.46 → 2.0.0-next.48
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/.env.example +11 -0
- package/CHANGELOG.md +42 -0
- package/apps/desktop/src/main/controllers/AuthCtr.ts +27 -2
- package/apps/desktop/src/main/core/infrastructure/ProtocolManager.ts +9 -4
- package/changelog/v1.json +14 -0
- package/docs/development/database-schema.dbml +2 -0
- package/docs/self-hosting/environment-variables/basic.mdx +49 -3
- package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +49 -4
- package/locales/ar/discover.json +45 -0
- package/locales/ar/marketAuth.json +42 -0
- package/locales/ar/setting.json +94 -1
- package/locales/bg-BG/discover.json +45 -0
- package/locales/bg-BG/marketAuth.json +42 -0
- package/locales/bg-BG/setting.json +94 -1
- package/locales/de-DE/discover.json +45 -0
- package/locales/de-DE/marketAuth.json +42 -0
- package/locales/de-DE/setting.json +94 -1
- package/locales/en-US/discover.json +45 -0
- package/locales/en-US/marketAuth.json +42 -0
- package/locales/en-US/setting.json +94 -1
- package/locales/es-ES/discover.json +45 -0
- package/locales/es-ES/marketAuth.json +42 -0
- package/locales/es-ES/setting.json +94 -1
- package/locales/fa-IR/discover.json +45 -0
- package/locales/fa-IR/marketAuth.json +42 -0
- package/locales/fa-IR/setting.json +94 -1
- package/locales/fr-FR/discover.json +45 -0
- package/locales/fr-FR/marketAuth.json +42 -0
- package/locales/fr-FR/setting.json +94 -1
- package/locales/it-IT/discover.json +45 -0
- package/locales/it-IT/marketAuth.json +42 -0
- package/locales/it-IT/setting.json +94 -1
- package/locales/ja-JP/discover.json +45 -0
- package/locales/ja-JP/marketAuth.json +42 -0
- package/locales/ja-JP/setting.json +94 -1
- package/locales/ko-KR/discover.json +45 -0
- package/locales/ko-KR/marketAuth.json +42 -0
- package/locales/ko-KR/setting.json +94 -1
- package/locales/nl-NL/discover.json +45 -0
- package/locales/nl-NL/marketAuth.json +42 -0
- package/locales/nl-NL/setting.json +94 -1
- package/locales/pl-PL/discover.json +45 -0
- package/locales/pl-PL/marketAuth.json +42 -0
- package/locales/pl-PL/setting.json +94 -1
- package/locales/pt-BR/discover.json +45 -0
- package/locales/pt-BR/marketAuth.json +42 -0
- package/locales/pt-BR/setting.json +94 -1
- package/locales/ru-RU/discover.json +45 -0
- package/locales/ru-RU/marketAuth.json +42 -0
- package/locales/ru-RU/setting.json +94 -1
- package/locales/tr-TR/discover.json +45 -0
- package/locales/tr-TR/marketAuth.json +42 -0
- package/locales/tr-TR/setting.json +94 -1
- package/locales/vi-VN/discover.json +45 -0
- package/locales/vi-VN/marketAuth.json +42 -0
- package/locales/vi-VN/setting.json +94 -1
- package/locales/zh-CN/discover.json +45 -0
- package/locales/zh-CN/marketAuth.json +42 -0
- package/locales/zh-CN/setting.json +94 -1
- package/locales/zh-TW/discover.json +45 -0
- package/locales/zh-TW/marketAuth.json +42 -0
- package/locales/zh-TW/setting.json +94 -1
- package/package.json +27 -26
- package/packages/const/src/url.ts +1 -0
- package/packages/database/migrations/0044_add_tool_intervention.sql +1 -0
- package/packages/database/migrations/0044_high_toxin.sql +1 -0
- package/packages/database/migrations/0045_add_tool_intervention.sql +1 -0
- package/packages/database/migrations/meta/0039_snapshot.json +1 -1
- package/packages/database/migrations/meta/0044_snapshot.json +7813 -0
- package/packages/database/migrations/meta/0045_snapshot.json +8431 -0
- package/packages/database/migrations/meta/_journal.json +14 -0
- package/packages/database/src/core/migrations.json +36 -7
- package/packages/database/src/models/file.ts +15 -1
- package/packages/database/src/models/message.ts +1 -1
- package/packages/database/src/models/session.ts +42 -1
- package/packages/database/src/repositories/aiInfra/index.test.ts +1 -1
- package/packages/database/src/repositories/dataExporter/index.test.ts +1 -1
- package/packages/database/src/repositories/tableViewer/index.test.ts +1 -1
- package/packages/database/src/schemas/agent.ts +1 -0
- package/packages/database/src/schemas/message.ts +5 -8
- package/packages/electron-client-ipc/src/events/index.ts +6 -1
- package/packages/electron-client-ipc/src/events/remoteServer.ts +8 -0
- package/packages/fetch-sse/package.json +29 -0
- package/packages/{utils/src/fetch → fetch-sse/src}/__tests__/fetchSSE.test.ts +4 -4
- package/packages/{utils/src/fetch → fetch-sse/src}/__tests__/parseError.test.ts +7 -4
- package/packages/{utils/src/fetch → fetch-sse/src}/fetchSSE.ts +2 -2
- package/packages/{utils/src/fetch → fetch-sse/src}/parseError.ts +3 -3
- package/packages/model-bank/src/aiModels/mistral.ts +2 -1
- package/packages/model-runtime/src/core/contextBuilders/anthropic.test.ts +17 -11
- package/packages/model-runtime/src/core/contextBuilders/anthropic.ts +1 -1
- package/packages/model-runtime/src/core/contextBuilders/google.test.ts +1 -1
- package/packages/model-runtime/src/core/contextBuilders/google.ts +3 -6
- package/packages/model-runtime/src/core/contextBuilders/openai.test.ts +4 -2
- package/packages/model-runtime/src/core/contextBuilders/openai.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.test.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts +3 -6
- package/packages/model-runtime/src/core/streams/openai/responsesStream.test.ts +1 -1
- package/packages/model-runtime/src/helpers/mergeChatMethodOptions.ts +2 -1
- package/packages/model-runtime/src/providers/aihubmix/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/generateObject.test.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/baichuan/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/bedrock/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/bfl/createImage.test.ts +4 -4
- package/packages/model-runtime/src/providers/bfl/createImage.ts +1 -1
- package/packages/model-runtime/src/providers/cloudflare/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/cohere/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/google/createImage.test.ts +2 -2
- package/packages/model-runtime/src/providers/google/createImage.ts +1 -1
- package/packages/model-runtime/src/providers/google/generateObject.test.ts +1 -1
- package/packages/model-runtime/src/providers/google/index.test.ts +1 -4
- package/packages/model-runtime/src/providers/groq/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/hunyuan/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/minimax/createImage.test.ts +1 -1
- package/packages/model-runtime/src/providers/mistral/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/moonshot/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/novita/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/ollama/index.test.ts +43 -32
- package/packages/model-runtime/src/providers/ollama/index.ts +31 -7
- package/packages/model-runtime/src/providers/openrouter/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/perplexity/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/ppio/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/qwen/createImage.test.ts +1 -1
- package/packages/model-runtime/src/providers/search1api/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/siliconcloud/createImage.ts +1 -1
- package/packages/model-runtime/src/providers/taichu/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/wenxin/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/zhipu/index.test.ts +1 -1
- package/packages/model-runtime/src/utils/errorResponse.test.ts +1 -1
- package/packages/ssrf-safe-fetch/index.browser.ts +14 -0
- package/packages/ssrf-safe-fetch/package.json +8 -1
- package/packages/types/src/aiProvider.ts +1 -1
- package/packages/types/src/discover/assistants.ts +16 -0
- package/packages/types/src/document/index.ts +38 -38
- package/packages/types/src/exportConfig.ts +15 -15
- package/packages/types/src/generation/index.ts +5 -5
- package/packages/types/src/index.ts +1 -0
- package/packages/types/src/message/common/tools.ts +10 -0
- package/packages/types/src/message/db/item.ts +15 -1
- package/packages/types/src/message/ui/params.ts +15 -1
- package/packages/types/src/meta.ts +4 -0
- package/packages/types/src/openai/chat.ts +15 -15
- package/packages/types/src/plugins/mcp.ts +29 -29
- package/packages/types/src/plugins/protocol.ts +43 -43
- package/packages/types/src/search.ts +4 -4
- package/packages/types/src/session/agentSession.ts +2 -0
- package/packages/types/src/tool/plugin.ts +3 -3
- package/packages/utils/src/imageToBase64.ts +17 -10
- package/packages/utils/src/index.ts +1 -1
- package/src/app/(backend)/f/[id]/route.ts +55 -0
- package/src/app/(backend)/market/agent/[[...segments]]/route.ts +153 -0
- package/src/app/(backend)/market/oidc/[[...segments]]/route.ts +207 -0
- package/src/app/[variants]/(main)/(mobile)/me/settings/features/useCategory.tsx +1 -0
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/PinList/index.tsx +4 -2
- package/src/app/[variants]/(main)/chat/settings/features/AgentInfoDescription/index.tsx +349 -0
- package/src/app/[variants]/(main)/chat/settings/features/HeaderContent.tsx +2 -2
- package/src/app/[variants]/(main)/chat/settings/features/PublishResultModal/index.tsx +64 -0
- package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/MarketPublishButton.tsx +196 -0
- package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/MarketPublishModal.tsx +358 -0
- package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/index.tsx +75 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/AssistantDetailPage.tsx +11 -2
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/Client.tsx +12 -1
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Nav.tsx +19 -12
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Overview/TagList.tsx +14 -5
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Overview/index.tsx +2 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Related/index.tsx +14 -5
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/SystemRole/TagList.tsx +14 -5
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/SystemRole/index.tsx +43 -29
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Versions/index.tsx +137 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/index.tsx +2 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Header.tsx +9 -10
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Sidebar/ActionButton/AddAgent.tsx +105 -14
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Sidebar/Related/index.tsx +20 -6
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/StatusPage/index.tsx +113 -0
- package/src/app/[variants]/(main)/discover/(detail)/features/Breadcrumb.tsx +4 -3
- package/src/app/[variants]/(main)/discover/(list)/_layout/Desktop/Nav.tsx +3 -1
- package/src/app/[variants]/(main)/discover/(list)/assistant/AssistantPage.tsx +4 -1
- package/src/app/[variants]/(main)/discover/(list)/assistant/Client.tsx +6 -2
- package/src/app/[variants]/(main)/discover/(list)/assistant/features/Category/index.tsx +7 -3
- package/src/app/[variants]/(main)/discover/(list)/assistant/features/List/Item.tsx +13 -2
- package/src/app/[variants]/(main)/discover/(list)/assistant/features/MarketSourceSwitch.tsx +64 -0
- package/src/app/[variants]/(main)/discover/(list)/features/SortButton/index.tsx +26 -7
- package/src/app/[variants]/(main)/profile/_layout/Desktop/index.tsx +10 -10
- package/src/app/[variants]/(main)/settings/_layout/type.ts +1 -1
- package/src/app/[variants]/(main)/settings/agent/index.tsx +11 -10
- package/src/app/[variants]/(main)/settings/common/index.tsx +1 -1
- package/src/app/[variants]/(main)/settings/page.tsx +13 -10
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/Item.tsx +35 -36
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/SearchResult.tsx +5 -5
- package/src/app/[variants]/(main)/settings/provider/_layout/Desktop/Container.tsx +10 -4
- package/src/app/market-auth-callback/layout.tsx +15 -0
- package/src/app/market-auth-callback/page.tsx +196 -0
- package/src/envs/app.ts +4 -3
- package/src/features/AgentSetting/AgentPrompt/TokenTag.tsx +3 -2
- package/src/features/AgentSetting/AgentTTS/SelectWithTTSPreview.tsx +1 -1
- package/src/features/AgentSetting/store/action.ts +1 -1
- package/src/features/ChatInput/ActionBar/STT/browser.tsx +1 -1
- package/src/features/ChatInput/ActionBar/STT/openai.tsx +1 -1
- package/src/features/Conversation/components/Extras/TTS/InitPlayer.tsx +1 -1
- package/src/features/Conversation/components/VirtualizedList/index.tsx +2 -1
- package/src/features/PluginTag/PluginStatus.tsx +1 -1
- package/src/features/PluginsUI/Render/MCPType/index.tsx +26 -6
- package/src/hooks/useAgentOwnershipCheck.ts +143 -0
- package/src/instrumentation.node.ts +3 -2
- package/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsx +364 -0
- package/src/layout/AuthProvider/MarketAuth/errors.ts +75 -0
- package/src/layout/AuthProvider/MarketAuth/index.ts +2 -0
- package/src/layout/AuthProvider/MarketAuth/oidc.ts +382 -0
- package/src/layout/AuthProvider/MarketAuth/types.ts +64 -0
- package/src/layout/AuthProvider/index.tsx +17 -4
- package/src/locales/default/discover.ts +46 -0
- package/src/locales/default/index.ts +2 -0
- package/src/locales/default/marketAuth.ts +42 -0
- package/src/locales/default/setting.ts +94 -1
- package/src/server/globalConfig/genServerAiProviderConfig.test.ts +5 -5
- package/src/server/globalConfig/genServerAiProviderConfig.ts +1 -1
- package/src/server/routers/desktop/mcp.ts +23 -8
- package/src/server/routers/lambda/market/index.ts +36 -14
- package/src/server/routers/lambda/message.ts +2 -2
- package/src/server/routers/tools/mcp.ts +24 -4
- package/src/server/services/discover/index.test.ts +153 -11
- package/src/server/services/discover/index.ts +339 -40
- package/src/server/services/file/impls/local.ts +4 -1
- package/src/server/services/file/index.ts +96 -1
- package/src/server/services/mcp/contentProcessor.ts +101 -0
- package/src/server/services/mcp/index.test.ts +52 -10
- package/src/server/services/mcp/index.ts +29 -26
- package/src/server/sitemap.ts +49 -35
- package/src/services/_url.ts +15 -1
- package/src/services/chat/chat.test.ts +5 -5
- package/src/services/chat/clientModelRuntime.test.ts +1 -1
- package/src/services/chat/index.ts +6 -6
- package/src/services/chat/types.ts +1 -2
- package/src/services/discover.ts +16 -5
- package/src/services/electron/remoteServer.ts +8 -1
- package/src/services/marketApi.ts +124 -0
- package/src/services/models.ts +2 -1
- package/src/services/session/index.ts +0 -14
- package/src/store/discover/slices/assistant/action.ts +20 -7
- package/{packages/utils/src → src/utils}/electron/desktopRemoteRPCFetch.ts +1 -1
- package/{packages/utils/src → src/utils/server}/parseModels.ts +1 -2
- package/src/utils/server/routeVariants.test.ts +340 -0
- package/vitest.config.mts +2 -0
- package/packages/model-runtime/src/utils/imageToBase64.test.ts +0 -91
- package/packages/model-runtime/src/utils/imageToBase64.ts +0 -62
- package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +0 -98
- package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/index.tsx +0 -35
- package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/style.ts +0 -47
- /package/packages/{utils/src/fetch → fetch-sse/src}/headers.ts +0 -0
- /package/packages/{utils/src/fetch → fetch-sse/src}/index.ts +0 -0
- /package/packages/{utils/src/fetch → fetch-sse/src}/request.ts +0 -0
- /package/{packages/utils/src → src/utils/server}/__snapshots__/parseModels.test.ts.snap +0 -0
- /package/{packages/utils/src → src/utils/server}/parseModels.test.ts +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { imageUrlToBase64 } from '@lobechat/utils';
|
|
1
2
|
import createDebug from 'debug';
|
|
2
3
|
import { RuntimeImageGenParamsValue } from 'model-bank';
|
|
3
4
|
|
|
@@ -5,7 +6,6 @@ import { CreateImageOptions } from '../../core/openaiCompatibleFactory';
|
|
|
5
6
|
import { CreateImagePayload, CreateImageResponse } from '../../types';
|
|
6
7
|
import { AgentRuntimeErrorType } from '../../types/error';
|
|
7
8
|
import { AgentRuntimeError } from '../../utils/createError';
|
|
8
|
-
import { imageUrlToBase64 } from '../../utils/imageToBase64';
|
|
9
9
|
import { parseDataUri } from '../../utils/uriParser';
|
|
10
10
|
|
|
11
11
|
const log = createDebug('lobe-image:siliconcloud');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @vitest-environment node
|
|
2
|
-
import { LobeOpenAICompatibleRuntime } from '@lobechat/model-runtime';
|
|
3
2
|
import { ModelProvider } from 'model-bank';
|
|
4
3
|
import OpenAI from 'openai';
|
|
5
4
|
import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
5
|
|
|
6
|
+
import { LobeOpenAICompatibleRuntime } from '../../core/BaseAI';
|
|
7
7
|
import { testProvider } from '../../providerTestUtils';
|
|
8
8
|
import * as debugStreamModule from '../../utils/debugStream';
|
|
9
9
|
import { LobeTaichuAI } from './index';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @vitest-environment node
|
|
2
|
-
import { LobeOpenAICompatibleRuntime } from '@lobechat/model-runtime';
|
|
3
2
|
import { ModelProvider } from 'model-bank';
|
|
4
3
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
5
4
|
|
|
5
|
+
import { LobeOpenAICompatibleRuntime } from '../../core/BaseAI';
|
|
6
6
|
import { testProvider } from '../../providerTestUtils';
|
|
7
7
|
import { LobeWenxinAI, params } from './index';
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @vitest-environment node
|
|
2
|
-
import { LobeOpenAICompatibleRuntime } from '@lobechat/model-runtime';
|
|
3
2
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
3
|
|
|
4
|
+
import { LobeOpenAICompatibleRuntime } from '../../core/BaseAI';
|
|
5
5
|
import { testProvider } from '../../providerTestUtils';
|
|
6
6
|
import { LobeZhipuAI, params } from './index';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AgentRuntimeErrorType } from '@lobechat/model-runtime';
|
|
2
1
|
import { ChatErrorType } from '@lobechat/types';
|
|
3
2
|
import { describe, expect, it, vi } from 'vitest';
|
|
4
3
|
|
|
4
|
+
import { AgentRuntimeErrorType } from '../types/error';
|
|
5
5
|
import { createErrorResponse } from './errorResponse';
|
|
6
6
|
|
|
7
7
|
describe('createErrorResponse', () => {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser version of SSRF-safe fetch
|
|
3
|
+
* In browser environments, we simply use the native fetch API
|
|
4
|
+
* as SSRF attacks are not applicable in client-side code
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Browser-safe fetch implementation
|
|
9
|
+
* Uses native fetch API in browser environments
|
|
10
|
+
*/
|
|
11
|
+
// eslint-disable-next-line no-undef
|
|
12
|
+
export const ssrfSafeFetch = async (url: string, options?: RequestInit): Promise<Response> => {
|
|
13
|
+
return fetch(url, options);
|
|
14
|
+
};
|
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
"name": "ssrf-safe-fetch",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"private": true,
|
|
5
|
-
"description": "",
|
|
5
|
+
"description": "SSRF-safe fetch implementation with browser/node conditional exports",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"browser": "./index.browser.ts",
|
|
9
|
+
"node": "./index.ts",
|
|
10
|
+
"default": "./index.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
6
13
|
"main": "index.ts",
|
|
7
14
|
"scripts": {
|
|
8
15
|
"test": "vitest run"
|
|
@@ -247,7 +247,7 @@ export const UpdateAiProviderConfigSchema = z.object({
|
|
|
247
247
|
z.string(),
|
|
248
248
|
z.union([
|
|
249
249
|
z.string().optional(),
|
|
250
|
-
z.record(z.string(), z.string()).optional(), //
|
|
250
|
+
z.record(z.string(), z.string()).optional(), // Support nested objects, e.g. customHeaders
|
|
251
251
|
]),
|
|
252
252
|
)
|
|
253
253
|
.optional(),
|
|
@@ -24,6 +24,7 @@ export enum AssistantSorts {
|
|
|
24
24
|
CreatedAt = 'createdAt',
|
|
25
25
|
Identifier = 'identifier',
|
|
26
26
|
KnowledgeCount = 'knowledgeCount',
|
|
27
|
+
MyOwn = 'myown',
|
|
27
28
|
PluginCount = 'pluginCount',
|
|
28
29
|
Title = 'title',
|
|
29
30
|
TokenUsage = 'tokenUsage',
|
|
@@ -34,6 +35,7 @@ export enum AssistantNavKey {
|
|
|
34
35
|
Overview = 'overview',
|
|
35
36
|
Related = 'related',
|
|
36
37
|
SystemRole = 'systemRole',
|
|
38
|
+
Version = 'version'
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export interface DiscoverAssistantItem extends Omit<LobeAgentSettings, 'meta'>, MetaData {
|
|
@@ -47,14 +49,18 @@ export interface DiscoverAssistantItem extends Omit<LobeAgentSettings, 'meta'>,
|
|
|
47
49
|
tokenUsage: number;
|
|
48
50
|
}
|
|
49
51
|
|
|
52
|
+
export type AssistantMarketSource = 'legacy' | 'new';
|
|
53
|
+
|
|
50
54
|
export interface AssistantQueryParams {
|
|
51
55
|
category?: string;
|
|
52
56
|
locale?: string;
|
|
53
57
|
order?: 'asc' | 'desc';
|
|
58
|
+
ownerId?: string;
|
|
54
59
|
page?: number;
|
|
55
60
|
pageSize?: number;
|
|
56
61
|
q?: string;
|
|
57
62
|
sort?: AssistantSorts;
|
|
63
|
+
source?: AssistantMarketSource;
|
|
58
64
|
}
|
|
59
65
|
|
|
60
66
|
export interface AssistantListResponse {
|
|
@@ -66,7 +72,17 @@ export interface AssistantListResponse {
|
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
export interface DiscoverAssistantDetail extends DiscoverAssistantItem {
|
|
75
|
+
currentVersion?: string;
|
|
69
76
|
examples?: FewShots;
|
|
70
77
|
related: DiscoverAssistantItem[];
|
|
71
78
|
summary?: string;
|
|
79
|
+
versions?: DiscoverAssistantVersion[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface DiscoverAssistantVersion {
|
|
83
|
+
createdAt?: string;
|
|
84
|
+
isLatest?: boolean;
|
|
85
|
+
isValidated?: boolean;
|
|
86
|
+
status?: 'published' | 'unpublished' | 'archived' | 'deprecated';
|
|
87
|
+
version: string;
|
|
72
88
|
}
|
|
@@ -1,172 +1,172 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Document object in LobeChat
|
|
3
3
|
*/
|
|
4
4
|
export interface LobeDocument {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* File content
|
|
7
7
|
*/
|
|
8
8
|
content: string | null;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* File creation timestamp
|
|
11
11
|
*/
|
|
12
12
|
createdAt: Date;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* File type or extension
|
|
16
16
|
*/
|
|
17
17
|
fileType: string;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Original filename
|
|
21
21
|
*/
|
|
22
22
|
filename: string;
|
|
23
23
|
|
|
24
24
|
id: string;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* File-level metadata
|
|
28
|
+
* For example, title and author extracted from file properties, or errors when the entire file fails to load
|
|
29
29
|
*/
|
|
30
30
|
metadata: {
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Allow adding other file-level metadata
|
|
33
33
|
*/
|
|
34
34
|
[key: string]: any;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Document author (if available)
|
|
37
37
|
*/
|
|
38
38
|
author?: string;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Error information if the entire file fails to load
|
|
41
41
|
*/
|
|
42
42
|
error?: string;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* Array containing all logical pages/blocks in the document
|
|
47
|
+
* Order typically corresponds to the natural order in the file
|
|
48
48
|
*/
|
|
49
49
|
pages?: LobeDocumentPage[];
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* Full path of the original file
|
|
53
53
|
*/
|
|
54
54
|
source: string;
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Document title (if available)
|
|
58
58
|
*/
|
|
59
59
|
title?: string;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
62
|
+
* Total character count of the entire document (sum of charCount of all Pages)
|
|
63
|
+
* Obtained after all Pages are loaded and calculated
|
|
64
64
|
*/
|
|
65
65
|
totalCharCount: number;
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
68
|
+
* Total line count of the entire document (sum of lineCount of all Pages)
|
|
69
|
+
* Obtained after all Pages are loaded and calculated
|
|
70
70
|
*/
|
|
71
71
|
totalLineCount: number;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* File last modified timestamp
|
|
75
75
|
*/
|
|
76
76
|
updatedAt: Date;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
80
|
+
* Represents a logical unit/page/block in a file
|
|
81
81
|
*/
|
|
82
82
|
export interface LobeDocumentPage {
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* Character count of this page/block content
|
|
85
85
|
*/
|
|
86
86
|
charCount: number;
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* Line count of this page/block content
|
|
90
90
|
*/
|
|
91
91
|
lineCount: number;
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* Metadata related to this page/block
|
|
95
95
|
*/
|
|
96
96
|
metadata: {
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
98
|
+
* Allow adding other page/block-specific metadata
|
|
99
99
|
*/
|
|
100
100
|
[key: string]: any;
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* If the original file unit is further split into chunks, this is the index of the current chunk
|
|
104
104
|
*/
|
|
105
105
|
chunkIndex?: number;
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* Errors that occurred while processing this page/block
|
|
109
109
|
*/
|
|
110
110
|
error?: string;
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
113
|
+
* Ending line number of this page/block in the original file
|
|
114
114
|
*/
|
|
115
115
|
lineNumberEnd?: number;
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
|
-
*
|
|
118
|
+
* Starting line number of this page/block in the original file
|
|
119
119
|
*/
|
|
120
120
|
lineNumberStart?: number;
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
123
|
+
* Page number (applicable to PDF, DOCX)
|
|
124
124
|
*/
|
|
125
125
|
pageNumber?: number;
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
128
|
+
* Section title related to this page/block
|
|
129
129
|
*/
|
|
130
130
|
sectionTitle?: string;
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
-
*
|
|
133
|
+
* Worksheet name (applicable to XLSX)
|
|
134
134
|
*/
|
|
135
135
|
sheetName?: string;
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
138
|
+
* Slide number (applicable to PPTX)
|
|
139
139
|
*/
|
|
140
140
|
slideNumber?: number;
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* If the original file unit is further split into chunks, this is the total number of chunks for that unit
|
|
144
144
|
*/
|
|
145
145
|
totalChunks?: number;
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
*
|
|
149
|
+
* Core text content of this page/block
|
|
150
150
|
*/
|
|
151
151
|
pageContent: string;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
*
|
|
155
|
+
* Document source type
|
|
156
156
|
*/
|
|
157
157
|
export enum DocumentSourceType {
|
|
158
158
|
/**
|
|
159
|
-
*
|
|
159
|
+
* Content from API
|
|
160
160
|
*/
|
|
161
161
|
API = 'api',
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
|
-
*
|
|
164
|
+
* Local or uploaded files
|
|
165
165
|
*/
|
|
166
166
|
FILE = 'file',
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
|
-
*
|
|
169
|
+
* Web content
|
|
170
170
|
*/
|
|
171
171
|
WEB = 'web',
|
|
172
172
|
}
|
|
@@ -6,14 +6,14 @@ import { UserSettings } from './user/settings';
|
|
|
6
6
|
// ---------- TODO: this file need to be deleted in V2 ---------- //
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Export type
|
|
10
10
|
* @enum ['agents', 'sessions', 'singleSession', 'settings', 'all']
|
|
11
11
|
* @enumNames ['agents', 'sessions', 'singleSession', 'settings', 'all']
|
|
12
12
|
*/
|
|
13
13
|
export type ExportType = 'agents' | 'sessions' | 'singleSession' | 'settings' | 'all';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Config model map
|
|
17
17
|
*/
|
|
18
18
|
export interface ConfigModelMap {
|
|
19
19
|
agents: {
|
|
@@ -38,10 +38,10 @@ export interface ConfigModelMap {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
// =============
|
|
41
|
+
// ============= Config Data Structures ============= //
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Config state: Sessions
|
|
45
45
|
*/
|
|
46
46
|
export interface ConfigStateSessions {
|
|
47
47
|
messages: UIChatMessage[];
|
|
@@ -51,7 +51,7 @@ export interface ConfigStateSessions {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Config state: Single session
|
|
55
55
|
*/
|
|
56
56
|
export interface ConfigStateSingleSession {
|
|
57
57
|
messages: UIChatMessage[];
|
|
@@ -60,7 +60,7 @@ export interface ConfigStateSingleSession {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Config state: Agents
|
|
64
64
|
*/
|
|
65
65
|
export interface ConfigStateAgents {
|
|
66
66
|
sessionGroups: SessionGroupItem[];
|
|
@@ -68,21 +68,21 @@ export interface ConfigStateAgents {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* Config state: Settings
|
|
72
72
|
*/
|
|
73
73
|
export interface ConfigStateSettings {
|
|
74
74
|
settings: UserSettings;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* Config state: All
|
|
79
79
|
*/
|
|
80
80
|
export interface ConfigStateAll extends ConfigStateSessions, ConfigStateSettings {}
|
|
81
81
|
|
|
82
|
-
// =============
|
|
82
|
+
// ============= Config File Types ============= //
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* Config file: Settings
|
|
86
86
|
*/
|
|
87
87
|
export interface ConfigFileSettings {
|
|
88
88
|
exportType: 'settings';
|
|
@@ -91,7 +91,7 @@ export interface ConfigFileSettings {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* Config file: Sessions
|
|
95
95
|
*/
|
|
96
96
|
export interface ConfigFileSessions {
|
|
97
97
|
exportType: 'sessions';
|
|
@@ -100,7 +100,7 @@ export interface ConfigFileSessions {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* Config file: Single session
|
|
104
104
|
*/
|
|
105
105
|
export interface ConfigFileSingleSession {
|
|
106
106
|
exportType: 'sessions';
|
|
@@ -109,7 +109,7 @@ export interface ConfigFileSingleSession {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* Config file: Agents
|
|
113
113
|
*/
|
|
114
114
|
export interface ConfigFileAgents {
|
|
115
115
|
exportType: 'agents';
|
|
@@ -118,7 +118,7 @@ export interface ConfigFileAgents {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
*
|
|
121
|
+
* Config file: All
|
|
122
122
|
*/
|
|
123
123
|
export interface ConfigFileAll {
|
|
124
124
|
exportType: 'all';
|
|
@@ -127,6 +127,6 @@ export interface ConfigFileAll {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
130
|
+
* Config file
|
|
131
131
|
*/
|
|
132
132
|
export type ConfigFile = ConfigFileSettings | ConfigFileSessions | ConfigFileAll | ConfigFileAgents;
|
|
@@ -14,23 +14,23 @@ export interface BaseGenerationAsset {
|
|
|
14
14
|
|
|
15
15
|
export interface ImageGenerationAsset extends BaseGenerationAsset {
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Height of the image/video
|
|
18
18
|
*/
|
|
19
19
|
height?: number;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* CDN URL from the API provider, typically expires quickly
|
|
22
22
|
*/
|
|
23
23
|
originalUrl?: string;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Thumbnail URL - for images it's a resized version, for videos it's a thumbnail of the cover
|
|
26
26
|
*/
|
|
27
27
|
thumbnailUrl?: string;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* URL stored in own OSS, only the key is stored. The full URL needs to be obtained using FileService.getFullFileUrl
|
|
30
30
|
*/
|
|
31
31
|
url?: string;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Width of the image/video
|
|
34
34
|
*/
|
|
35
35
|
width?: number;
|
|
36
36
|
}
|
|
@@ -103,3 +103,13 @@ export interface ChatMessagePluginError {
|
|
|
103
103
|
message: string;
|
|
104
104
|
type: IPluginErrorType;
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
export interface ToolIntervention {
|
|
108
|
+
rejectedReason?: string;
|
|
109
|
+
status?: 'pending' | 'approved' | 'rejected' | 'none';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const ToolInterventionSchema = z.object({
|
|
113
|
+
rejectedReason: z.string().optional(),
|
|
114
|
+
status: z.enum(['pending', 'approved', 'rejected', 'none']).optional(),
|
|
115
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable sort-keys-fix/sort-keys-fix , typescript-sort-keys/interface */
|
|
2
2
|
import { GroundingSearch } from '../../search';
|
|
3
|
-
import { MessageMetadata, ModelReasoning } from '../common';
|
|
3
|
+
import { MessageMetadata, ModelReasoning, ToolIntervention } from '../common';
|
|
4
4
|
|
|
5
5
|
export interface DBMessageItem {
|
|
6
6
|
id: string;
|
|
@@ -33,3 +33,17 @@ export interface DBMessageItem {
|
|
|
33
33
|
updatedAt: Date;
|
|
34
34
|
createdAt: Date;
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
export interface MessagePluginItem {
|
|
38
|
+
id: string;
|
|
39
|
+
toolCallId?: string;
|
|
40
|
+
type: string;
|
|
41
|
+
intervention?: ToolIntervention;
|
|
42
|
+
apiName?: string;
|
|
43
|
+
arguments?: string;
|
|
44
|
+
identifier?: string;
|
|
45
|
+
state?: any;
|
|
46
|
+
error?: any;
|
|
47
|
+
clientId?: string;
|
|
48
|
+
userId: string;
|
|
49
|
+
}
|
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
import { UploadFileItem } from '../../files';
|
|
5
5
|
import { MessageSemanticSearchChunk } from '../../rag';
|
|
6
6
|
import { ChatMessageError, ChatMessageErrorSchema } from '../common/base';
|
|
7
|
-
import { ChatPluginPayload } from '../common/tools';
|
|
7
|
+
import { ChatPluginPayload, ToolInterventionSchema } from '../common/tools';
|
|
8
8
|
import { UIChatMessage } from './chat';
|
|
9
9
|
import { SemanticSearchChunkSchema } from './rag';
|
|
10
10
|
|
|
@@ -148,3 +148,17 @@ export const CreateNewMessageParamsSchema = z
|
|
|
148
148
|
fileChunks: z.array(SemanticSearchChunkSchema).optional(),
|
|
149
149
|
})
|
|
150
150
|
.passthrough();
|
|
151
|
+
|
|
152
|
+
export const UpdateMessagePluginSchema = z.object({
|
|
153
|
+
id: z.string().optional(),
|
|
154
|
+
toolCallId: z.string().optional(),
|
|
155
|
+
type: z.string().optional(),
|
|
156
|
+
intervention: ToolInterventionSchema.optional(),
|
|
157
|
+
apiName: z.string().optional(),
|
|
158
|
+
arguments: z.string().optional(),
|
|
159
|
+
identifier: z.string().optional(),
|
|
160
|
+
state: z.any().optional(),
|
|
161
|
+
error: z.any().optional(),
|
|
162
|
+
clientId: z.string().optional(),
|
|
163
|
+
userId: z.string().optional(),
|
|
164
|
+
});
|
|
@@ -10,6 +10,10 @@ export const LobeMetaDataSchema = z.object({
|
|
|
10
10
|
*/
|
|
11
11
|
backgroundColor: z.string().optional(),
|
|
12
12
|
description: z.string().optional(),
|
|
13
|
+
/**
|
|
14
|
+
* Market agent identifier for published agents
|
|
15
|
+
*/
|
|
16
|
+
marketIdentifier: z.string().optional(),
|
|
13
17
|
|
|
14
18
|
tags: z.array(z.string()).optional(),
|
|
15
19
|
/**
|