@lobehub/chat 1.2.0 → 1.2.2
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/.bunfig.toml +3 -0
- package/.dockerignore +11 -0
- package/.env.example +183 -0
- package/.eslintignore +1 -2
- package/.eslintrc.js +32 -1
- package/.github/FUNDING.yml +13 -0
- package/.github/ISSUE_TEMPLATE/1_bug_report.yml +46 -22
- package/.github/ISSUE_TEMPLATE/1_bug_report_cn.yml +69 -0
- package/.github/ISSUE_TEMPLATE/2_feature_request.yml +6 -6
- package/.github/ISSUE_TEMPLATE/2_feature_request_cn.yml +21 -0
- package/.github/ISSUE_TEMPLATE/config.yml +4 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +2 -0
- package/.github/workflows/docker.yml +45 -0
- package/.github/workflows/issue-auto-comments.yml +73 -0
- package/.github/workflows/issue-close-require.yml +26 -6
- package/.github/workflows/issues-translate.yml +14 -0
- package/.github/workflows/lighthouse.yml +72 -0
- package/.github/workflows/release.yml +46 -15
- package/.github/workflows/sync.yml +54 -0
- package/.github/workflows/test.yml +44 -16
- package/.github/workflows/wiki-sync.yml +19 -0
- package/.husky/pre-commit +0 -3
- package/.i18nrc.js +41 -7
- package/.nvmrc +1 -0
- package/.seorc.cjs +9 -0
- package/CHANGELOG.md +17495 -56
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +88 -0
- package/Dockerfile +138 -0
- package/LICENSE +38 -0
- package/README.md +739 -80
- package/README.zh-CN.md +828 -0
- package/__mocks__/zustand/traditional.ts +25 -0
- package/codecov.yml +11 -0
- package/contributing/Basic/Add-New-Authentication-Providers.md +193 -0
- package/contributing/Basic/Add-New-Authentication-Providers.zh-CN.md +192 -0
- package/contributing/Basic/Architecture.md +47 -0
- package/contributing/Basic/Architecture.zh-CN.md +47 -0
- package/contributing/Basic/Chat-API.md +136 -0
- package/contributing/Basic/Chat-API.zh-CN.md +174 -0
- package/contributing/Basic/Contributing-Guidelines.md +83 -0
- package/contributing/Basic/Contributing-Guidelines.zh-CN.md +85 -0
- package/contributing/Basic/Feature-Development-Frontend.md +126 -0
- package/contributing/Basic/Feature-Development-Frontend.zh-CN.md +126 -0
- package/contributing/Basic/Feature-Development.md +713 -0
- package/contributing/Basic/Feature-Development.zh-CN.md +707 -0
- package/contributing/Basic/Folder-Structure.md +40 -0
- package/contributing/Basic/Folder-Structure.zh-CN.md +40 -0
- package/contributing/Basic/Intro.md +111 -0
- package/contributing/Basic/Intro.zh-CN.md +111 -0
- package/contributing/Basic/Resources.md +19 -0
- package/contributing/Basic/Resources.zh-CN.md +19 -0
- package/contributing/Basic/Setup-Development.md +69 -0
- package/contributing/Basic/Setup-Development.zh-CN.md +69 -0
- package/contributing/Basic/Test.md +87 -0
- package/contributing/Basic/Test.zh-CN.md +87 -0
- package/contributing/Home.md +87 -0
- package/contributing/Internationalization/Add-New-Locale.md +62 -0
- package/contributing/Internationalization/Add-New-Locale.zh-CN.md +62 -0
- package/contributing/Internationalization/Internationalization-Implementation.md +125 -0
- package/contributing/Internationalization/Internationalization-Implementation.zh-CN.md +125 -0
- package/contributing/Others/Lighthouse.md +65 -0
- package/contributing/Others/Lighthouse.zh-CN.md +65 -0
- package/contributing/State-Management/State-Management-Intro.md +224 -0
- package/contributing/State-Management/State-Management-Intro.zh-CN.md +216 -0
- package/contributing/State-Management/State-Management-Selectors.md +68 -0
- package/contributing/State-Management/State-Management-Selectors.zh-CN.md +49 -0
- package/contributing/Upstream-Sync.md +58 -0
- package/contributing/Upstream-Sync.zh-CN.md +58 -0
- package/contributing/_Footer.md +1 -0
- package/contributing/_Sidebar.md +48 -0
- package/docs/self-hosting/advanced/analytics.mdx +31 -0
- package/docs/self-hosting/advanced/analytics.zh-CN.mdx +28 -0
- package/docs/self-hosting/advanced/authentication.mdx +67 -0
- package/docs/self-hosting/advanced/authentication.zh-CN.mdx +65 -0
- package/docs/self-hosting/advanced/feature-flags.mdx +47 -0
- package/docs/self-hosting/advanced/feature-flags.zh-CN.mdx +43 -0
- package/docs/self-hosting/advanced/model-list.mdx +48 -0
- package/docs/self-hosting/advanced/model-list.zh-CN.mdx +47 -0
- package/docs/self-hosting/advanced/server-database.mdx +425 -0
- package/docs/self-hosting/advanced/server-database.zh-CN.mdx +413 -0
- package/docs/self-hosting/advanced/settings-url-share.mdx +147 -0
- package/docs/self-hosting/advanced/settings-url-share.zh-CN.mdx +145 -0
- package/docs/self-hosting/advanced/sso-providers/auth0.mdx +133 -0
- package/docs/self-hosting/advanced/sso-providers/auth0.zh-CN.mdx +125 -0
- package/docs/self-hosting/advanced/sso-providers/authentik.mdx +74 -0
- package/docs/self-hosting/advanced/sso-providers/authentik.zh-CN.mdx +68 -0
- package/docs/self-hosting/advanced/sso-providers/github.mdx +102 -0
- package/docs/self-hosting/advanced/sso-providers/github.zh-CN.mdx +94 -0
- package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.mdx +105 -0
- package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.zh-CN.mdx +99 -0
- package/docs/self-hosting/advanced/sso-providers/zitadel.mdx +119 -0
- package/docs/self-hosting/advanced/sso-providers/zitadel.zh-CN.mdx +112 -0
- package/docs/self-hosting/advanced/upstream-sync.mdx +161 -0
- package/docs/self-hosting/advanced/upstream-sync.zh-CN.mdx +153 -0
- package/docs/self-hosting/environment-variables/analytics.mdx +84 -0
- package/docs/self-hosting/environment-variables/analytics.zh-CN.mdx +82 -0
- package/docs/self-hosting/environment-variables/auth.mdx +171 -0
- package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +168 -0
- package/docs/self-hosting/environment-variables/basic.mdx +118 -0
- package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +114 -0
- package/docs/self-hosting/environment-variables/model-provider.mdx +299 -0
- package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +297 -0
- package/docs/self-hosting/environment-variables.mdx +22 -0
- package/docs/self-hosting/environment-variables.zh-CN.mdx +20 -0
- package/docs/self-hosting/examples/azure-openai.mdx +46 -0
- package/docs/self-hosting/examples/azure-openai.zh-CN.mdx +48 -0
- package/docs/self-hosting/examples/ollama.mdx +104 -0
- package/docs/self-hosting/examples/ollama.zh-CN.mdx +102 -0
- package/docs/self-hosting/faq/no-v1-suffix.mdx +30 -0
- package/docs/self-hosting/faq/no-v1-suffix.zh-CN.mdx +27 -0
- package/docs/self-hosting/faq/proxy-with-unable-to-verify-leaf-signature.mdx +84 -0
- package/docs/self-hosting/faq/proxy-with-unable-to-verify-leaf-signature.zh-CN.mdx +81 -0
- package/docs/self-hosting/platform/docker-compose.mdx +143 -0
- package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +133 -0
- package/docs/self-hosting/platform/docker.mdx +169 -0
- package/docs/self-hosting/platform/docker.zh-CN.mdx +167 -0
- package/docs/self-hosting/platform/netlify.mdx +154 -0
- package/docs/self-hosting/platform/netlify.zh-CN.mdx +148 -0
- package/docs/self-hosting/platform/railway.mdx +35 -0
- package/docs/self-hosting/platform/railway.zh-CN.mdx +34 -0
- package/docs/self-hosting/platform/repocloud.mdx +38 -0
- package/docs/self-hosting/platform/repocloud.zh-CN.mdx +36 -0
- package/docs/self-hosting/platform/sealos.mdx +37 -0
- package/docs/self-hosting/platform/sealos.zh-CN.mdx +36 -0
- package/docs/self-hosting/platform/vercel.mdx +46 -0
- package/docs/self-hosting/platform/vercel.zh-CN.mdx +48 -0
- package/docs/self-hosting/platform/zeabur.mdx +84 -0
- package/docs/self-hosting/platform/zeabur.zh-CN.mdx +83 -0
- package/docs/self-hosting/start.mdx +31 -0
- package/docs/self-hosting/start.zh-CN.mdx +32 -0
- package/docs/usage/agents/concepts.mdx +41 -0
- package/docs/usage/agents/concepts.zh-CN.mdx +38 -0
- package/docs/usage/agents/custom-agent.mdx +58 -0
- package/docs/usage/agents/custom-agent.zh-CN.mdx +53 -0
- package/docs/usage/agents/model.mdx +80 -0
- package/docs/usage/agents/model.zh-CN.mdx +75 -0
- package/docs/usage/agents/prompt.mdx +110 -0
- package/docs/usage/agents/prompt.zh-CN.mdx +106 -0
- package/docs/usage/agents/topics.mdx +27 -0
- package/docs/usage/agents/topics.zh-CN.mdx +25 -0
- package/docs/usage/features/agent-market.mdx +40 -0
- package/docs/usage/features/agent-market.zh-CN.mdx +36 -0
- package/docs/usage/features/auth.mdx +65 -0
- package/docs/usage/features/auth.zh-CN.mdx +60 -0
- package/docs/usage/features/database.mdx +60 -0
- package/docs/usage/features/database.zh-CN.mdx +54 -0
- package/docs/usage/features/local-llm.mdx +56 -0
- package/docs/usage/features/local-llm.zh-CN.mdx +48 -0
- package/docs/usage/features/mobile.mdx +24 -0
- package/docs/usage/features/mobile.zh-CN.mdx +23 -0
- package/docs/usage/features/more.mdx +33 -0
- package/docs/usage/features/more.zh-CN.mdx +28 -0
- package/docs/usage/features/multi-ai-providers.mdx +66 -0
- package/docs/usage/features/multi-ai-providers.zh-CN.mdx +66 -0
- package/docs/usage/features/plugin-system.mdx +89 -0
- package/docs/usage/features/plugin-system.zh-CN.mdx +78 -0
- package/docs/usage/features/pwa.mdx +74 -0
- package/docs/usage/features/pwa.zh-CN.mdx +74 -0
- package/docs/usage/features/text-to-image.mdx +26 -0
- package/docs/usage/features/text-to-image.zh-CN.mdx +26 -0
- package/docs/usage/features/theme.mdx +34 -0
- package/docs/usage/features/theme.zh-CN.mdx +30 -0
- package/docs/usage/features/tts.mdx +52 -0
- package/docs/usage/features/tts.zh-CN.mdx +46 -0
- package/docs/usage/features/vision.mdx +28 -0
- package/docs/usage/features/vision.zh-CN.mdx +25 -0
- package/docs/usage/plugins/basic-usage.mdx +69 -0
- package/docs/usage/plugins/basic-usage.zh-CN.mdx +67 -0
- package/docs/usage/plugins/custom-plugin.mdx +37 -0
- package/docs/usage/plugins/custom-plugin.zh-CN.mdx +35 -0
- package/docs/usage/plugins/development.mdx +329 -0
- package/docs/usage/plugins/development.zh-CN.mdx +323 -0
- package/docs/usage/plugins/store.mdx +30 -0
- package/docs/usage/plugins/store.zh-CN.mdx +27 -0
- package/docs/usage/providers/01ai.mdx +85 -0
- package/docs/usage/providers/01ai.zh-CN.mdx +85 -0
- package/docs/usage/providers/anthropic.mdx +78 -0
- package/docs/usage/providers/anthropic.zh-CN.mdx +75 -0
- package/docs/usage/providers/azure.mdx +88 -0
- package/docs/usage/providers/azure.zh-CN.mdx +79 -0
- package/docs/usage/providers/bedrock.mdx +139 -0
- package/docs/usage/providers/bedrock.zh-CN.mdx +134 -0
- package/docs/usage/providers/deepseek.mdx +90 -0
- package/docs/usage/providers/deepseek.zh-CN.mdx +85 -0
- package/docs/usage/providers/gemini.mdx +82 -0
- package/docs/usage/providers/gemini.zh-CN.mdx +78 -0
- package/docs/usage/providers/groq.mdx +72 -0
- package/docs/usage/providers/groq.zh-CN.mdx +67 -0
- package/docs/usage/providers/minimax.mdx +87 -0
- package/docs/usage/providers/minimax.zh-CN.mdx +84 -0
- package/docs/usage/providers/mistral.mdx +69 -0
- package/docs/usage/providers/mistral.zh-CN.mdx +64 -0
- package/docs/usage/providers/moonshot.mdx +68 -0
- package/docs/usage/providers/moonshot.zh-CN.mdx +63 -0
- package/docs/usage/providers/ollama/gemma.mdx +68 -0
- package/docs/usage/providers/ollama/gemma.zh-CN.mdx +67 -0
- package/docs/usage/providers/ollama/qwen.mdx +69 -0
- package/docs/usage/providers/ollama/qwen.zh-CN.mdx +66 -0
- package/docs/usage/providers/ollama.mdx +205 -0
- package/docs/usage/providers/ollama.zh-CN.mdx +203 -0
- package/docs/usage/providers/openai.mdx +94 -0
- package/docs/usage/providers/openai.zh-CN.mdx +87 -0
- package/docs/usage/providers/openrouter.mdx +110 -0
- package/docs/usage/providers/openrouter.zh-CN.mdx +104 -0
- package/docs/usage/providers/perplexity.mdx +62 -0
- package/docs/usage/providers/perplexity.zh-CN.mdx +59 -0
- package/docs/usage/providers/qwen.mdx +92 -0
- package/docs/usage/providers/qwen.zh-CN.mdx +87 -0
- package/docs/usage/providers/stepfun.mdx +66 -0
- package/docs/usage/providers/stepfun.zh-CN.mdx +62 -0
- package/docs/usage/providers/togetherai.mdx +72 -0
- package/docs/usage/providers/togetherai.zh-CN.mdx +70 -0
- package/docs/usage/providers/zhipu.mdx +67 -0
- package/docs/usage/providers/zhipu.zh-CN.mdx +61 -0
- package/docs/usage/providers.mdx +36 -0
- package/docs/usage/providers.zh-CN.mdx +34 -0
- package/docs/usage/start.mdx +48 -0
- package/docs/usage/start.zh-CN.mdx +40 -0
- package/docs/usage/tools-calling/anthropic.mdx +1 -0
- package/docs/usage/tools-calling/anthropic.zh-CN.mdx +956 -0
- package/docs/usage/tools-calling/google.mdx +1 -0
- package/docs/usage/tools-calling/google.zh-CN.mdx +13 -0
- package/docs/usage/tools-calling/groq.mdx +1 -0
- package/docs/usage/tools-calling/groq.zh-CN.mdx +15 -0
- package/docs/usage/tools-calling/openai.mdx +1 -0
- package/docs/usage/tools-calling/openai.zh-CN.mdx +833 -0
- package/docs/usage/tools-calling.mdx +3 -0
- package/docs/usage/tools-calling.zh-CN.mdx +255 -0
- package/drizzle.config.ts +29 -0
- package/locales/ar/auth.json +8 -0
- package/locales/ar/chat.json +137 -0
- package/locales/ar/clerk.json +769 -0
- package/locales/ar/common.json +224 -0
- package/locales/ar/components.json +16 -0
- package/locales/ar/error.json +117 -0
- package/locales/ar/market.json +32 -0
- package/locales/ar/metadata.json +18 -0
- package/locales/ar/migration.json +45 -0
- package/locales/ar/modelProvider.json +108 -0
- package/locales/ar/plugin.json +166 -0
- package/locales/ar/portal.json +4 -0
- package/locales/ar/setting.json +411 -0
- package/locales/ar/tool.json +10 -0
- package/locales/ar/welcome.json +49 -0
- package/locales/bg-BG/auth.json +8 -0
- package/locales/bg-BG/chat.json +137 -0
- package/locales/bg-BG/clerk.json +769 -0
- package/locales/bg-BG/common.json +224 -0
- package/locales/bg-BG/components.json +16 -0
- package/locales/bg-BG/error.json +117 -0
- package/locales/bg-BG/market.json +32 -0
- package/locales/bg-BG/metadata.json +18 -0
- package/locales/bg-BG/migration.json +45 -0
- package/locales/bg-BG/modelProvider.json +108 -0
- package/locales/bg-BG/plugin.json +166 -0
- package/locales/bg-BG/portal.json +4 -0
- package/locales/bg-BG/setting.json +411 -0
- package/locales/bg-BG/tool.json +10 -0
- package/locales/bg-BG/welcome.json +49 -0
- package/locales/de-DE/auth.json +8 -0
- package/locales/de-DE/chat.json +137 -0
- package/locales/de-DE/clerk.json +769 -0
- package/locales/de-DE/common.json +224 -0
- package/locales/de-DE/components.json +16 -0
- package/locales/de-DE/error.json +117 -0
- package/locales/de-DE/market.json +32 -0
- package/locales/de-DE/metadata.json +18 -0
- package/locales/de-DE/migration.json +45 -0
- package/locales/de-DE/modelProvider.json +108 -0
- package/locales/de-DE/plugin.json +166 -0
- package/locales/de-DE/portal.json +4 -0
- package/locales/de-DE/setting.json +411 -0
- package/locales/de-DE/tool.json +10 -0
- package/locales/de-DE/welcome.json +49 -0
- package/locales/en-US/auth.json +8 -0
- package/locales/en-US/chat.json +137 -0
- package/locales/en-US/clerk.json +769 -0
- package/locales/en-US/common.json +224 -0
- package/locales/en-US/components.json +16 -0
- package/locales/en-US/error.json +117 -0
- package/locales/en-US/market.json +32 -0
- package/locales/en-US/metadata.json +18 -0
- package/locales/en-US/migration.json +45 -0
- package/locales/en-US/modelProvider.json +108 -0
- package/locales/en-US/plugin.json +166 -0
- package/locales/en-US/portal.json +4 -0
- package/locales/en-US/setting.json +411 -0
- package/locales/en-US/tool.json +10 -0
- package/locales/en-US/welcome.json +49 -0
- package/locales/es-ES/auth.json +8 -0
- package/locales/es-ES/chat.json +137 -0
- package/locales/es-ES/clerk.json +769 -0
- package/locales/es-ES/common.json +224 -0
- package/locales/es-ES/components.json +16 -0
- package/locales/es-ES/error.json +117 -0
- package/locales/es-ES/market.json +32 -0
- package/locales/es-ES/metadata.json +18 -0
- package/locales/es-ES/migration.json +45 -0
- package/locales/es-ES/modelProvider.json +108 -0
- package/locales/es-ES/plugin.json +166 -0
- package/locales/es-ES/portal.json +4 -0
- package/locales/es-ES/setting.json +411 -0
- package/locales/es-ES/tool.json +10 -0
- package/locales/es-ES/welcome.json +49 -0
- package/locales/fr-FR/auth.json +8 -0
- package/locales/fr-FR/chat.json +137 -0
- package/locales/fr-FR/clerk.json +769 -0
- package/locales/fr-FR/common.json +224 -0
- package/locales/fr-FR/components.json +16 -0
- package/locales/fr-FR/error.json +117 -0
- package/locales/fr-FR/market.json +32 -0
- package/locales/fr-FR/metadata.json +18 -0
- package/locales/fr-FR/migration.json +45 -0
- package/locales/fr-FR/modelProvider.json +108 -0
- package/locales/fr-FR/plugin.json +166 -0
- package/locales/fr-FR/portal.json +4 -0
- package/locales/fr-FR/setting.json +411 -0
- package/locales/fr-FR/tool.json +10 -0
- package/locales/fr-FR/welcome.json +49 -0
- package/locales/it-IT/auth.json +8 -0
- package/locales/it-IT/chat.json +137 -0
- package/locales/it-IT/clerk.json +769 -0
- package/locales/it-IT/common.json +224 -0
- package/locales/it-IT/components.json +16 -0
- package/locales/it-IT/error.json +117 -0
- package/locales/it-IT/market.json +32 -0
- package/locales/it-IT/metadata.json +18 -0
- package/locales/it-IT/migration.json +45 -0
- package/locales/it-IT/modelProvider.json +108 -0
- package/locales/it-IT/plugin.json +166 -0
- package/locales/it-IT/portal.json +4 -0
- package/locales/it-IT/setting.json +411 -0
- package/locales/it-IT/tool.json +10 -0
- package/locales/it-IT/welcome.json +49 -0
- package/locales/ja-JP/auth.json +8 -0
- package/locales/ja-JP/chat.json +137 -0
- package/locales/ja-JP/clerk.json +769 -0
- package/locales/ja-JP/common.json +224 -0
- package/locales/ja-JP/components.json +16 -0
- package/locales/ja-JP/error.json +117 -0
- package/locales/ja-JP/market.json +32 -0
- package/locales/ja-JP/metadata.json +18 -0
- package/locales/ja-JP/migration.json +45 -0
- package/locales/ja-JP/modelProvider.json +108 -0
- package/locales/ja-JP/plugin.json +166 -0
- package/locales/ja-JP/portal.json +4 -0
- package/locales/ja-JP/setting.json +411 -0
- package/locales/ja-JP/tool.json +10 -0
- package/locales/ja-JP/welcome.json +49 -0
- package/locales/ko-KR/auth.json +8 -0
- package/locales/ko-KR/chat.json +137 -0
- package/locales/ko-KR/clerk.json +769 -0
- package/locales/ko-KR/common.json +224 -0
- package/locales/ko-KR/components.json +16 -0
- package/locales/ko-KR/error.json +117 -0
- package/locales/ko-KR/market.json +32 -0
- package/locales/ko-KR/metadata.json +18 -0
- package/locales/ko-KR/migration.json +45 -0
- package/locales/ko-KR/modelProvider.json +108 -0
- package/locales/ko-KR/plugin.json +166 -0
- package/locales/ko-KR/portal.json +4 -0
- package/locales/ko-KR/setting.json +411 -0
- package/locales/ko-KR/tool.json +10 -0
- package/locales/ko-KR/welcome.json +49 -0
- package/locales/nl-NL/auth.json +8 -0
- package/locales/nl-NL/chat.json +137 -0
- package/locales/nl-NL/clerk.json +769 -0
- package/locales/nl-NL/common.json +224 -0
- package/locales/nl-NL/components.json +16 -0
- package/locales/nl-NL/error.json +117 -0
- package/locales/nl-NL/market.json +32 -0
- package/locales/nl-NL/metadata.json +18 -0
- package/locales/nl-NL/migration.json +45 -0
- package/locales/nl-NL/modelProvider.json +108 -0
- package/locales/nl-NL/plugin.json +166 -0
- package/locales/nl-NL/portal.json +4 -0
- package/locales/nl-NL/setting.json +411 -0
- package/locales/nl-NL/tool.json +10 -0
- package/locales/nl-NL/welcome.json +49 -0
- package/locales/pl-PL/auth.json +8 -0
- package/locales/pl-PL/chat.json +137 -0
- package/locales/pl-PL/clerk.json +769 -0
- package/locales/pl-PL/common.json +224 -0
- package/locales/pl-PL/components.json +16 -0
- package/locales/pl-PL/error.json +117 -0
- package/locales/pl-PL/market.json +32 -0
- package/locales/pl-PL/metadata.json +18 -0
- package/locales/pl-PL/migration.json +45 -0
- package/locales/pl-PL/modelProvider.json +108 -0
- package/locales/pl-PL/plugin.json +166 -0
- package/locales/pl-PL/portal.json +4 -0
- package/locales/pl-PL/setting.json +411 -0
- package/locales/pl-PL/tool.json +10 -0
- package/locales/pl-PL/welcome.json +49 -0
- package/locales/pt-BR/auth.json +8 -0
- package/locales/pt-BR/chat.json +137 -0
- package/locales/pt-BR/clerk.json +769 -0
- package/locales/pt-BR/common.json +224 -0
- package/locales/pt-BR/components.json +16 -0
- package/locales/pt-BR/error.json +117 -0
- package/locales/pt-BR/market.json +32 -0
- package/locales/pt-BR/metadata.json +18 -0
- package/locales/pt-BR/migration.json +45 -0
- package/locales/pt-BR/modelProvider.json +108 -0
- package/locales/pt-BR/plugin.json +166 -0
- package/locales/pt-BR/portal.json +4 -0
- package/locales/pt-BR/setting.json +411 -0
- package/locales/pt-BR/tool.json +10 -0
- package/locales/pt-BR/welcome.json +49 -0
- package/locales/ru-RU/auth.json +8 -0
- package/locales/ru-RU/chat.json +137 -0
- package/locales/ru-RU/clerk.json +769 -0
- package/locales/ru-RU/common.json +224 -0
- package/locales/ru-RU/components.json +16 -0
- package/locales/ru-RU/error.json +117 -0
- package/locales/ru-RU/market.json +32 -0
- package/locales/ru-RU/metadata.json +18 -0
- package/locales/ru-RU/migration.json +45 -0
- package/locales/ru-RU/modelProvider.json +108 -0
- package/locales/ru-RU/plugin.json +166 -0
- package/locales/ru-RU/portal.json +4 -0
- package/locales/ru-RU/setting.json +411 -0
- package/locales/ru-RU/tool.json +10 -0
- package/locales/ru-RU/welcome.json +49 -0
- package/locales/tr-TR/auth.json +8 -0
- package/locales/tr-TR/chat.json +137 -0
- package/locales/tr-TR/clerk.json +769 -0
- package/locales/tr-TR/common.json +224 -0
- package/locales/tr-TR/components.json +16 -0
- package/locales/tr-TR/error.json +117 -0
- package/locales/tr-TR/market.json +32 -0
- package/locales/tr-TR/metadata.json +18 -0
- package/locales/tr-TR/migration.json +45 -0
- package/locales/tr-TR/modelProvider.json +108 -0
- package/locales/tr-TR/plugin.json +166 -0
- package/locales/tr-TR/portal.json +4 -0
- package/locales/tr-TR/setting.json +411 -0
- package/locales/tr-TR/tool.json +10 -0
- package/locales/tr-TR/welcome.json +49 -0
- package/locales/vi-VN/auth.json +8 -0
- package/locales/vi-VN/chat.json +137 -0
- package/locales/vi-VN/clerk.json +769 -0
- package/locales/vi-VN/common.json +224 -0
- package/locales/vi-VN/components.json +16 -0
- package/locales/vi-VN/error.json +117 -0
- package/locales/vi-VN/market.json +32 -0
- package/locales/vi-VN/metadata.json +18 -0
- package/locales/vi-VN/migration.json +45 -0
- package/locales/vi-VN/modelProvider.json +108 -0
- package/locales/vi-VN/plugin.json +166 -0
- package/locales/vi-VN/portal.json +4 -0
- package/locales/vi-VN/setting.json +411 -0
- package/locales/vi-VN/tool.json +10 -0
- package/locales/vi-VN/welcome.json +49 -0
- package/locales/zh-CN/auth.json +8 -0
- package/locales/zh-CN/chat.json +137 -0
- package/locales/zh-CN/clerk.json +769 -0
- package/locales/zh-CN/common.json +224 -0
- package/locales/zh-CN/components.json +16 -0
- package/locales/zh-CN/error.json +117 -0
- package/locales/zh-CN/market.json +32 -0
- package/locales/zh-CN/metadata.json +18 -0
- package/locales/zh-CN/migration.json +45 -0
- package/locales/zh-CN/modelProvider.json +108 -0
- package/locales/zh-CN/plugin.json +166 -0
- package/locales/zh-CN/portal.json +4 -0
- package/locales/zh-CN/setting.json +411 -0
- package/locales/zh-CN/tool.json +10 -0
- package/locales/zh-CN/welcome.json +49 -0
- package/locales/zh-TW/auth.json +8 -0
- package/locales/zh-TW/chat.json +137 -0
- package/locales/zh-TW/clerk.json +769 -0
- package/locales/zh-TW/common.json +224 -0
- package/locales/zh-TW/components.json +16 -0
- package/locales/zh-TW/error.json +117 -0
- package/locales/zh-TW/market.json +32 -0
- package/locales/zh-TW/metadata.json +18 -0
- package/locales/zh-TW/migration.json +45 -0
- package/locales/zh-TW/modelProvider.json +108 -0
- package/locales/zh-TW/plugin.json +166 -0
- package/locales/zh-TW/portal.json +4 -0
- package/locales/zh-TW/setting.json +411 -0
- package/locales/zh-TW/tool.json +10 -0
- package/locales/zh-TW/welcome.json +49 -0
- package/netlify.toml +10 -0
- package/next-sitemap.config.mjs +53 -0
- package/next.config.mjs +183 -9
- package/package.json +215 -85
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-32x32.ico +0 -0
- package/public/favicon.ico +0 -0
- package/public/icons/icon-192x192.maskable.png +0 -0
- package/public/icons/icon-192x192.png +0 -0
- package/public/icons/icon-512x512.maskable.png +0 -0
- package/public/icons/icon-512x512.png +0 -0
- package/public/images/banner_market_modal.webp +0 -0
- package/public/images/chatmode_chat_dark.webp +0 -0
- package/public/images/chatmode_chat_light.webp +0 -0
- package/public/images/chatmode_docs_dark.webp +0 -0
- package/public/images/chatmode_docs_light.webp +0 -0
- package/public/images/empty_topic_dark.webp +0 -0
- package/public/images/empty_topic_light.webp +0 -0
- package/public/images/logo.png +0 -0
- package/public/images/screenshot_background.webp +0 -0
- package/public/images/theme_auto.webp +0 -0
- package/public/images/theme_dark.webp +0 -0
- package/public/images/theme_light.webp +0 -0
- package/public/manifest.json +166 -0
- package/public/og/cover.png +0 -0
- package/public/screenshots/shot-1.desktop.png +0 -0
- package/public/screenshots/shot-1.mobile.png +0 -0
- package/public/screenshots/shot-2.desktop.png +0 -0
- package/public/screenshots/shot-2.mobile.png +0 -0
- package/public/screenshots/shot-3.desktop.png +0 -0
- package/public/screenshots/shot-3.mobile.png +0 -0
- package/public/screenshots/shot-4.desktop.png +0 -0
- package/public/screenshots/shot-4.mobile.png +0 -0
- package/public/screenshots/shot-5.desktop.png +0 -0
- package/public/screenshots/shot-5.mobile.png +0 -0
- package/public/videos/feedback.mp4 +0 -0
- package/public/videos/star.mp4 +0 -0
- package/renovate.json +13 -0
- package/scripts/docsWorkflow/const.ts +14 -0
- package/scripts/docsWorkflow/index.ts +82 -0
- package/scripts/docsWorkflow/toc.ts +60 -0
- package/scripts/docsWorkflow/utils.ts +38 -0
- package/scripts/i18nWorkflow/const.ts +18 -0
- package/scripts/i18nWorkflow/genDefaultLocale.ts +19 -0
- package/scripts/i18nWorkflow/genDiff.ts +50 -0
- package/scripts/i18nWorkflow/index.ts +11 -0
- package/scripts/i18nWorkflow/utils.ts +54 -0
- package/scripts/mdxWorkflow/index.ts +48 -0
- package/scripts/migrateServerDB/index.ts +32 -0
- package/scripts/readmeWorkflow/const.ts +19 -0
- package/scripts/readmeWorkflow/index.ts +12 -0
- package/scripts/readmeWorkflow/syncAgentIndex.ts +47 -0
- package/scripts/readmeWorkflow/syncPluginIndex.ts +42 -0
- package/scripts/readmeWorkflow/utlis.ts +52 -0
- package/sentry.client.config.ts +30 -0
- package/sentry.edge.config.ts +17 -0
- package/sentry.server.config.ts +19 -0
- package/src/app/(auth)/layout.tsx +19 -0
- package/src/app/(auth)/login/[[...login]]/page.tsx +21 -0
- package/src/app/(auth)/signup/[[...signup]]/page.tsx +21 -0
- package/src/app/(loading)/Client.tsx +13 -0
- package/src/app/(loading)/Redirect.tsx +51 -0
- package/src/app/(main)/(mobile)/me/(home)/__tests__/UserBanner.test.tsx +80 -0
- package/src/app/(main)/(mobile)/me/(home)/__tests__/useCategory.test.tsx +116 -0
- package/src/app/(main)/(mobile)/me/(home)/features/Category.tsx +15 -0
- package/src/app/(main)/(mobile)/me/(home)/features/Header.tsx +30 -0
- package/src/app/(main)/(mobile)/me/(home)/features/UserBanner.tsx +37 -0
- package/src/app/(main)/(mobile)/me/(home)/features/useCategory.tsx +118 -0
- package/src/app/(main)/(mobile)/me/(home)/layout.tsx +17 -0
- package/src/app/(main)/(mobile)/me/(home)/loading.tsx +38 -0
- package/src/app/(main)/(mobile)/me/(home)/page.tsx +38 -0
- package/src/app/(main)/(mobile)/me/data/features/Category.tsx +48 -0
- package/src/app/(main)/(mobile)/me/data/features/Header.tsx +33 -0
- package/src/app/(main)/(mobile)/me/data/layout.tsx +13 -0
- package/src/app/(main)/(mobile)/me/data/loading.tsx +5 -0
- package/src/app/(main)/(mobile)/me/data/page.tsx +27 -0
- package/src/app/(main)/(mobile)/me/profile/features/Category.tsx +45 -0
- package/src/app/(main)/(mobile)/me/profile/features/Header.tsx +33 -0
- package/src/app/(main)/(mobile)/me/profile/layout.tsx +16 -0
- package/src/app/(main)/(mobile)/me/profile/loading.tsx +5 -0
- package/src/app/(main)/(mobile)/me/profile/page.tsx +28 -0
- package/src/app/(main)/(mobile)/me/settings/features/Category.tsx +15 -0
- package/src/app/(main)/(mobile)/me/settings/features/Header.tsx +33 -0
- package/src/app/(main)/(mobile)/me/settings/features/useCategory.tsx +62 -0
- package/src/app/(main)/(mobile)/me/settings/layout.tsx +13 -0
- package/src/app/(main)/(mobile)/me/settings/loading.tsx +5 -0
- package/src/app/(main)/(mobile)/me/settings/page.tsx +28 -0
- package/src/app/(main)/@nav/_layout/Desktop/Avatar.test.tsx +55 -0
- package/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx +53 -0
- package/src/app/(main)/@nav/_layout/Desktop/BottomActions.tsx +24 -0
- package/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx +50 -0
- package/src/app/(main)/@nav/_layout/Desktop/index.tsx +26 -0
- package/src/app/(main)/@nav/_layout/Mobile.tsx +71 -0
- package/src/app/(main)/@nav/default.tsx +10 -0
- package/src/app/(main)/_layout/Desktop.tsx +33 -0
- package/src/app/(main)/_layout/Mobile.tsx +29 -0
- package/src/app/(main)/_layout/type.ts +6 -0
- package/src/app/(main)/chat/(workspace)/@conversation/default.tsx +23 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatHydration/index.tsx +33 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/DragUpload.tsx +245 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/LocalFiles.tsx +10 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/SendMore.tsx +120 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/index.tsx +182 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Header/index.tsx +25 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/TextArea.test.tsx +316 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/TextArea.tsx +129 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/__tests__/useAutoFocus.test.ts +45 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/index.tsx +60 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/useAutoFocus.ts +13 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/Files.tsx +19 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/index.tsx +52 -0
- package/src/app/(main)/chat/(workspace)/@portal/_layout/Desktop.tsx +17 -0
- package/src/app/(main)/chat/(workspace)/@portal/_layout/Mobile.tsx +18 -0
- package/src/app/(main)/chat/(workspace)/@portal/default.tsx +27 -0
- package/src/app/(main)/chat/(workspace)/@portal/features/Header.tsx +52 -0
- package/src/app/(main)/chat/(workspace)/@portal/features/Tools/ToolList/Item/index.tsx +74 -0
- package/src/app/(main)/chat/(workspace)/@portal/features/Tools/ToolList/Item/style.ts +46 -0
- package/src/app/(main)/chat/(workspace)/@portal/features/Tools/ToolList/index.tsx +39 -0
- package/src/app/(main)/chat/(workspace)/@portal/features/Tools/ToolUI/Footer.tsx +33 -0
- package/src/app/(main)/chat/(workspace)/@portal/features/Tools/ToolUI/ToolRender.tsx +50 -0
- package/src/app/(main)/chat/(workspace)/@portal/features/Tools/ToolUI/index.tsx +37 -0
- package/src/app/(main)/chat/(workspace)/@portal/index.tsx +18 -0
- package/src/app/(main)/chat/(workspace)/@topic/_layout/Desktop.tsx +17 -0
- package/src/app/(main)/chat/(workspace)/@topic/_layout/Mobile.tsx +21 -0
- package/src/app/(main)/chat/(workspace)/@topic/default.tsx +32 -0
- package/src/app/(main)/chat/(workspace)/@topic/features/Header.tsx +88 -0
- package/src/app/(main)/chat/(workspace)/@topic/features/SkeletonList.tsx +57 -0
- package/src/app/(main)/chat/(workspace)/@topic/features/SystemRole/SystemRoleContent.tsx +128 -0
- package/src/app/(main)/chat/(workspace)/@topic/features/SystemRole/index.tsx +18 -0
- package/src/app/(main)/chat/(workspace)/@topic/features/SystemRole/style.ts +32 -0
- package/src/app/(main)/chat/(workspace)/@topic/features/TopicListContent/DefaultContent.tsx +29 -0
- package/src/app/(main)/chat/(workspace)/@topic/features/TopicListContent/TopicContent.tsx +211 -0
- package/src/app/(main)/chat/(workspace)/@topic/features/TopicListContent/TopicItem.tsx +81 -0
- package/src/app/(main)/chat/(workspace)/@topic/features/TopicListContent/index.tsx +107 -0
- package/src/app/(main)/chat/(workspace)/@topic/features/TopicSearchBar/index.tsx +42 -0
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/HeaderAction.tsx +40 -0
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx +91 -0
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Tags.tsx +31 -0
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/index.tsx +8 -0
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/HotKeys.tsx +49 -0
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/Portal.tsx +79 -0
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/TopicPanel.tsx +82 -0
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/index.tsx +37 -0
- package/src/app/(main)/chat/(workspace)/_layout/Mobile/ChatHeader/ChatHeaderTitle.tsx +55 -0
- package/src/app/(main)/chat/(workspace)/_layout/Mobile/ChatHeader/index.tsx +37 -0
- package/src/app/(main)/chat/(workspace)/_layout/Mobile/TopicModal.tsx +35 -0
- package/src/app/(main)/chat/(workspace)/_layout/Mobile/index.tsx +21 -0
- package/src/app/(main)/chat/(workspace)/_layout/type.ts +8 -0
- package/src/app/(main)/chat/(workspace)/_layout/useInitAgentConfig.ts +10 -0
- package/src/app/(main)/chat/(workspace)/features/PluginTag/PluginStatus.tsx +108 -0
- package/src/app/(main)/chat/(workspace)/features/PluginTag/index.tsx +60 -0
- package/src/app/(main)/chat/(workspace)/features/SettingButton.tsx +25 -0
- package/src/app/(main)/chat/(workspace)/features/ShareButton/Preview.tsx +79 -0
- package/src/app/(main)/chat/(workspace)/features/ShareButton/ShareModal.tsx +164 -0
- package/src/app/(main)/chat/(workspace)/features/ShareButton/index.tsx +40 -0
- package/src/app/(main)/chat/(workspace)/features/ShareButton/style.ts +71 -0
- package/src/app/(main)/chat/(workspace)/features/ShareButton/type.ts +14 -0
- package/src/app/(main)/chat/(workspace)/features/ShareButton/useScreenshot.ts +60 -0
- package/src/app/(main)/chat/(workspace)/features/TelemetryNotification.tsx +93 -0
- package/src/app/(main)/chat/(workspace)/features/useWorkspaceModal.tsx +27 -0
- package/src/app/(main)/chat/(workspace)/layout.ts +11 -0
- package/src/app/(main)/chat/(workspace)/page.tsx +39 -0
- package/src/app/(main)/chat/@session/_layout/Desktop/PanelBody.tsx +22 -0
- package/src/app/(main)/chat/@session/_layout/Desktop/SessionHeader.tsx +60 -0
- package/src/app/(main)/chat/@session/_layout/Desktop/index.tsx +18 -0
- package/src/app/(main)/chat/@session/_layout/Mobile/SessionHeader.tsx +45 -0
- package/src/app/(main)/chat/@session/_layout/Mobile/index.tsx +22 -0
- package/src/app/(main)/chat/@session/default.tsx +29 -0
- package/src/app/(main)/chat/@session/features/SessionHydration.tsx +45 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/CollapseGroup/Actions.tsx +141 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/CollapseGroup/index.tsx +63 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/DefaultMode.tsx +106 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/Inbox/index.tsx +38 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/List/AddButton.tsx +28 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/List/Item/Actions.tsx +196 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/List/Item/index.tsx +95 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/List/index.tsx +67 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/ListItem/index.tsx +67 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/Modals/ConfigGroupModal/GroupItem.tsx +89 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/Modals/ConfigGroupModal/index.tsx +85 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/Modals/CreateGroupModal.tsx +70 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/Modals/RenameGroupModal.tsx +59 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/SearchMode.tsx +21 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/index.tsx +18 -0
- package/src/app/(main)/chat/@session/features/SessionListContent/useSwitchSession.ts +26 -0
- package/src/app/(main)/chat/@session/features/SessionSearchBar.tsx +37 -0
- package/src/app/(main)/chat/@session/features/SkeletonList.tsx +51 -0
- package/src/app/(main)/chat/_layout/Desktop/SessionPanel.tsx +75 -0
- package/src/app/(main)/chat/_layout/Desktop/index.tsx +31 -0
- package/src/app/(main)/chat/_layout/Mobile.tsx +49 -0
- package/src/app/(main)/chat/_layout/type.ts +6 -0
- package/src/app/(main)/chat/error.tsx +5 -0
- package/src/app/(main)/chat/features/Migration/ExportConfigButton.tsx +33 -0
- package/src/app/(main)/chat/features/Migration/Failed.tsx +118 -0
- package/src/app/(main)/chat/features/Migration/Modal.tsx +80 -0
- package/src/app/(main)/chat/features/Migration/Start.tsx +106 -0
- package/src/app/(main)/chat/features/Migration/UpgradeButton.tsx +74 -0
- package/src/app/(main)/chat/features/Migration/const.ts +15 -0
- package/src/app/(main)/chat/features/Migration/index.tsx +39 -0
- package/src/app/(main)/chat/features/PageTitle/index.tsx +17 -0
- package/src/app/(main)/chat/layout.ts +11 -0
- package/src/app/(main)/chat/loading.tsx +3 -0
- package/src/app/(main)/chat/not-found.tsx +3 -0
- package/src/app/(main)/chat/settings/_layout/Desktop/Header.tsx +26 -0
- package/src/app/(main)/chat/settings/_layout/Desktop/index.tsx +21 -0
- package/src/app/(main)/chat/settings/_layout/Mobile/Header.tsx +27 -0
- package/src/app/(main)/chat/settings/_layout/Mobile/index.tsx +19 -0
- package/src/app/(main)/chat/settings/error.tsx +5 -0
- package/src/app/(main)/chat/settings/features/EditPage.tsx +40 -0
- package/src/app/(main)/chat/settings/features/HeaderContent.tsx +70 -0
- package/src/app/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +98 -0
- package/src/app/(main)/chat/settings/features/SubmitAgentButton/index.tsx +36 -0
- package/src/app/(main)/chat/settings/features/SubmitAgentButton/style.ts +46 -0
- package/src/app/(main)/chat/settings/layout.tsx +21 -0
- package/src/app/(main)/chat/settings/loading.tsx +3 -0
- package/src/app/(main)/chat/settings/modal/page.tsx +23 -0
- package/src/app/(main)/chat/settings/not-found.tsx +3 -0
- package/src/app/(main)/chat/settings/page.tsx +7 -0
- package/src/app/(main)/error.tsx +5 -0
- package/src/app/(main)/layout.tsx +11 -0
- package/src/app/(main)/market/@detail/default.tsx +12 -0
- package/src/app/(main)/market/@detail/features/AgentDetailContent.tsx +73 -0
- package/src/app/(main)/market/@detail/features/Banner.tsx +46 -0
- package/src/app/(main)/market/@detail/features/Comment.tsx +16 -0
- package/src/app/(main)/market/@detail/features/Header.tsx +81 -0
- package/src/app/(main)/market/@detail/features/Loading.tsx +63 -0
- package/src/app/(main)/market/@detail/features/TokenTag.tsx +26 -0
- package/src/app/(main)/market/@detail/features/style.ts +31 -0
- package/src/app/(main)/market/_layout/Desktop/DetailSidebar.tsx +84 -0
- package/src/app/(main)/market/_layout/Desktop/Header.tsx +28 -0
- package/src/app/(main)/market/_layout/Desktop/Hero.tsx +39 -0
- package/src/app/(main)/market/_layout/Desktop/index.tsx +46 -0
- package/src/app/(main)/market/_layout/Mobile/DetailModal.tsx +32 -0
- package/src/app/(main)/market/_layout/Mobile/Header.tsx +20 -0
- package/src/app/(main)/market/_layout/Mobile/index.tsx +25 -0
- package/src/app/(main)/market/_layout/type.ts +6 -0
- package/src/app/(main)/market/features/AgentCard/AgentCardBanner.tsx +59 -0
- package/src/app/(main)/market/features/AgentCard/index.tsx +139 -0
- package/src/app/(main)/market/features/AgentList.tsx +103 -0
- package/src/app/(main)/market/features/AgentSearchBar.tsx +42 -0
- package/src/app/(main)/market/features/ShareAgentButton/Inner.tsx +54 -0
- package/src/app/(main)/market/features/ShareAgentButton/index.tsx +50 -0
- package/src/app/(main)/market/features/TagList.tsx +69 -0
- package/src/app/(main)/market/layout.tsx +11 -0
- package/src/app/(main)/market/loading.tsx +15 -0
- package/src/app/(main)/market/page.tsx +44 -0
- package/src/app/(main)/not-found.tsx +3 -0
- package/src/app/(main)/profile/[[...slugs]]/Client.tsx +74 -0
- package/src/app/(main)/profile/[[...slugs]]/page.tsx +21 -0
- package/src/app/(main)/profile/_layout/Mobile/Header.tsx +26 -0
- package/src/app/(main)/profile/_layout/Mobile/index.tsx +16 -0
- package/src/app/(main)/profile/layout.tsx +20 -0
- package/src/app/(main)/profile/loading.tsx +23 -0
- package/src/app/(main)/settings/@category/default.tsx +15 -0
- package/src/app/(main)/settings/@category/features/CategoryContent.tsx +37 -0
- package/src/app/(main)/settings/@category/features/UpgradeAlert.tsx +38 -0
- package/src/app/(main)/settings/_layout/Desktop/Header.tsx +85 -0
- package/src/app/(main)/settings/_layout/Desktop/SideBar.tsx +59 -0
- package/src/app/(main)/settings/_layout/Desktop/index.tsx +54 -0
- package/src/app/(main)/settings/_layout/Mobile/Header.tsx +43 -0
- package/src/app/(main)/settings/_layout/Mobile/index.tsx +18 -0
- package/src/app/(main)/settings/_layout/type.ts +6 -0
- package/src/app/(main)/settings/about/features/AboutList.tsx +27 -0
- package/src/app/(main)/settings/about/features/Analytics.tsx +42 -0
- package/src/app/(main)/settings/about/features/ItemCard.tsx +45 -0
- package/src/app/(main)/settings/about/features/ItemLink.tsx +32 -0
- package/src/app/(main)/settings/about/features/Version.tsx +79 -0
- package/src/app/(main)/settings/about/index.tsx +139 -0
- package/src/app/(main)/settings/about/page.tsx +20 -0
- package/src/app/(main)/settings/agent/index.tsx +33 -0
- package/src/app/(main)/settings/agent/page.tsx +12 -0
- package/src/app/(main)/settings/common/features/Common.tsx +171 -0
- package/src/app/(main)/settings/common/features/Theme/ThemeSwatches/ThemeSwatchesNeutral.tsx +33 -0
- package/src/app/(main)/settings/common/features/Theme/ThemeSwatches/ThemeSwatchesPrimary.tsx +33 -0
- package/src/app/(main)/settings/common/features/Theme/index.tsx +148 -0
- package/src/app/(main)/settings/common/index.tsx +15 -0
- package/src/app/(main)/settings/common/page.tsx +13 -0
- package/src/app/(main)/settings/error.tsx +5 -0
- package/src/app/(main)/settings/features/UpgradeAlert.tsx +42 -0
- package/src/app/(main)/settings/hooks/useCategory.tsx +94 -0
- package/src/app/(main)/settings/hooks/useSyncSettings.ts +23 -0
- package/src/app/(main)/settings/layout.ts +11 -0
- package/src/app/(main)/settings/llm/ProviderList/Azure/index.tsx +107 -0
- package/src/app/(main)/settings/llm/ProviderList/Bedrock/index.tsx +68 -0
- package/src/app/(main)/settings/llm/ProviderList/Ollama/Checker.tsx +73 -0
- package/src/app/(main)/settings/llm/ProviderList/Ollama/index.tsx +29 -0
- package/src/app/(main)/settings/llm/ProviderList/OpenAI/index.tsx +20 -0
- package/src/app/(main)/settings/llm/ProviderList/providers.tsx +183 -0
- package/src/app/(main)/settings/llm/components/Checker.tsx +113 -0
- package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +295 -0
- package/src/app/(main)/settings/llm/components/ProviderModelList/CustomModelOption.tsx +93 -0
- package/src/app/(main)/settings/llm/components/ProviderModelList/ModelConfigModal/Form.tsx +98 -0
- package/src/app/(main)/settings/llm/components/ProviderModelList/ModelConfigModal/MaxTokenSlider.tsx +103 -0
- package/src/app/(main)/settings/llm/components/ProviderModelList/ModelConfigModal/index.tsx +78 -0
- package/src/app/(main)/settings/llm/components/ProviderModelList/ModelFetcher.tsx +86 -0
- package/src/app/(main)/settings/llm/components/ProviderModelList/Option.tsx +66 -0
- package/src/app/(main)/settings/llm/components/ProviderModelList/index.tsx +147 -0
- package/src/app/(main)/settings/llm/const.ts +20 -0
- package/src/app/(main)/settings/llm/features/Footer.tsx +35 -0
- package/src/app/(main)/settings/llm/index.tsx +24 -0
- package/src/app/(main)/settings/llm/page.tsx +23 -0
- package/src/app/(main)/settings/llm/type.ts +5 -0
- package/src/app/(main)/settings/loading.tsx +9 -0
- package/src/app/(main)/settings/modal/page.tsx +27 -0
- package/src/app/(main)/settings/not-found.tsx +3 -0
- package/src/app/(main)/settings/sync/features/Alert.tsx +39 -0
- package/src/app/(main)/settings/sync/features/DeviceInfo/Card.tsx +42 -0
- package/src/app/(main)/settings/sync/features/DeviceInfo/DeviceName.tsx +63 -0
- package/src/app/(main)/settings/sync/features/DeviceInfo/SystemIcon.tsx +29 -0
- package/src/app/(main)/settings/sync/features/DeviceInfo/index.tsx +103 -0
- package/src/app/(main)/settings/sync/features/WebRTC/ChannelNameInput.tsx +46 -0
- package/src/app/(main)/settings/sync/features/WebRTC/SyncSwitch/index.css +237 -0
- package/src/app/(main)/settings/sync/features/WebRTC/SyncSwitch/index.tsx +79 -0
- package/src/app/(main)/settings/sync/features/WebRTC/generateRandomRoomName.ts +4 -0
- package/src/app/(main)/settings/sync/features/WebRTC/index.tsx +98 -0
- package/src/app/(main)/settings/sync/index.tsx +17 -0
- package/src/app/(main)/settings/sync/page.tsx +26 -0
- package/src/app/(main)/settings/system-agent/features/createForm.tsx +59 -0
- package/src/app/(main)/settings/system-agent/features/useSync.ts +23 -0
- package/src/app/(main)/settings/system-agent/index.tsx +15 -0
- package/src/app/(main)/settings/system-agent/page.tsx +14 -0
- package/src/app/(main)/settings/tts/features/OpenAI.tsx +54 -0
- package/src/app/(main)/settings/tts/features/STT.tsx +58 -0
- package/src/app/(main)/settings/tts/features/const.ts +30 -0
- package/src/app/(main)/settings/tts/index.tsx +15 -0
- package/src/app/(main)/settings/tts/page.tsx +12 -0
- package/src/app/(main)/welcome/_layout/Desktop.tsx +41 -0
- package/src/app/(main)/welcome/_layout/Mobile.tsx +12 -0
- package/src/app/(main)/welcome/features/Actions.tsx +39 -0
- package/src/app/(main)/welcome/features/Hero.tsx +63 -0
- package/src/app/(main)/welcome/features/Logo.tsx +30 -0
- package/src/app/(main)/welcome/layout.tsx +10 -0
- package/src/app/(main)/welcome/page.tsx +41 -0
- package/src/app/@modal/(.)settings/modal/index.tsx +45 -0
- package/src/app/@modal/(.)settings/modal/layout.tsx +44 -0
- package/src/app/@modal/(.)settings/modal/loading.tsx +5 -0
- package/src/app/@modal/(.)settings/modal/page.tsx +19 -0
- package/src/app/@modal/_layout/SettingModalLayout.tsx +71 -0
- package/src/app/@modal/chat/(.)settings/modal/features/CategoryContent.tsx +37 -0
- package/src/app/@modal/chat/(.)settings/modal/features/useCategory.tsx +54 -0
- package/src/app/@modal/chat/(.)settings/modal/layout.tsx +58 -0
- package/src/app/@modal/chat/(.)settings/modal/loading.tsx +5 -0
- package/src/app/@modal/chat/(.)settings/modal/page.tsx +55 -0
- package/src/app/@modal/default.tsx +3 -0
- package/src/app/@modal/error.tsx +5 -0
- package/src/app/@modal/layout.tsx +34 -0
- package/src/app/@modal/loading.tsx +5 -0
- package/src/app/api/auth/[...nextauth]/route.ts +3 -0
- package/src/app/api/chat/[provider]/route.test.ts +222 -0
- package/src/app/api/chat/[provider]/route.ts +56 -0
- package/src/app/api/chat/agentRuntime.test.ts +350 -0
- package/src/app/api/chat/agentRuntime.ts +254 -0
- package/src/app/api/chat/anthropic/route.test.ts +28 -0
- package/src/app/api/chat/anthropic/route.ts +33 -0
- package/src/app/api/chat/apiKeyManager.test.ts +131 -0
- package/src/app/api/chat/apiKeyManager.ts +46 -0
- package/src/app/api/chat/google/route.test.ts +28 -0
- package/src/app/api/chat/google/route.ts +20 -0
- package/src/app/api/chat/minimax/route.test.ts +24 -0
- package/src/app/api/chat/minimax/route.ts +5 -0
- package/src/app/api/chat/models/[provider]/route.ts +45 -0
- package/src/app/api/config.test.ts +43 -0
- package/src/app/api/config.ts +14 -0
- package/src/app/api/errorResponse.test.ts +100 -0
- package/src/app/api/errorResponse.ts +54 -0
- package/src/app/api/market/AgentMarket.test.ts +55 -0
- package/src/app/api/market/AgentMarket.ts +25 -0
- package/src/app/api/market/[id]/route.ts +22 -0
- package/src/app/api/market/route.ts +23 -0
- package/src/app/api/middleware/auth/index.test.ts +77 -0
- package/src/app/api/middleware/auth/index.ts +62 -0
- package/src/app/api/middleware/auth/utils.test.ts +150 -0
- package/src/app/api/middleware/auth/utils.ts +83 -0
- package/src/app/api/openai/createBizOpenAI/auth.test.ts +53 -0
- package/src/app/api/openai/createBizOpenAI/auth.ts +31 -0
- package/src/app/api/openai/createBizOpenAI/createAzureOpenai.ts +33 -0
- package/src/app/api/openai/createBizOpenAI/createOpenai.ts +17 -0
- package/src/app/api/openai/createBizOpenAI/index.ts +37 -0
- package/src/app/api/openai/stt/route.ts +31 -0
- package/src/app/api/openai/tts/route.ts +19 -0
- package/src/app/api/plugin/gateway/route.ts +82 -0
- package/src/app/api/plugin/gateway/settings.test.ts +105 -0
- package/src/app/api/plugin/gateway/settings.ts +29 -0
- package/src/app/api/plugin/store/Store.test.ts +26 -0
- package/src/app/api/plugin/store/Store.ts +19 -0
- package/src/app/api/plugin/store/route.ts +23 -0
- package/src/app/api/proxy/route.ts +34 -0
- package/src/app/api/text-to-image/[provider]/route.ts +61 -0
- package/src/app/api/trace/route.ts +40 -0
- package/src/app/api/tts/edge-speech/route.ts +9 -0
- package/src/app/api/tts/microsoft-speech/route.ts +9 -0
- package/src/app/api/webhooks/clerk/__tests__/fixtures/createUser.json +73 -0
- package/src/app/api/webhooks/clerk/route.ts +79 -0
- package/src/app/api/webhooks/clerk/validateRequest.ts +22 -0
- package/src/app/error.tsx +5 -0
- package/src/app/global-error.tsx +20 -0
- package/src/app/layout.tsx +65 -0
- package/src/app/metadata.ts +59 -0
- package/src/app/not-found.tsx +3 -0
- package/src/app/page.tsx +23 -0
- package/src/app/trpc/edge/[trpc]/route.ts +28 -0
- package/src/app/trpc/lambda/[trpc]/route.ts +26 -0
- package/src/app/trpc/tools/[trpc]/route.ts +26 -0
- package/src/chains/__tests__/langDetect.test.ts +51 -0
- package/src/chains/__tests__/pickEmoji.test.ts +47 -0
- package/src/chains/__tests__/summaryAgentName.test.ts +57 -0
- package/src/chains/__tests__/summaryDescription.test.ts +83 -0
- package/src/chains/__tests__/summaryTags.test.ts +54 -0
- package/src/chains/__tests__/summaryTitle.test.ts +54 -0
- package/src/chains/__tests__/translate.test.ts +28 -0
- package/src/chains/langDetect.ts +31 -0
- package/src/chains/pickEmoji.ts +31 -0
- package/src/chains/summaryAgentName.ts +35 -0
- package/src/chains/summaryDescription.ts +49 -0
- package/src/chains/summaryTags.ts +28 -0
- package/src/chains/summaryTitle.ts +21 -0
- package/src/chains/translate.ts +17 -0
- package/src/components/404/index.tsx +43 -0
- package/src/components/Analytics/Clarity.tsx +28 -0
- package/src/components/Analytics/Google.tsx +7 -0
- package/src/components/Analytics/Plausible.tsx +16 -0
- package/src/components/Analytics/Posthog.tsx +22 -0
- package/src/components/Analytics/Umami.tsx +16 -0
- package/src/components/Analytics/Vercel.tsx +8 -0
- package/src/components/Analytics/index.tsx +44 -0
- package/src/components/AntdStaticMethods/index.test.tsx +43 -0
- package/src/components/AntdStaticMethods/index.tsx +20 -0
- package/src/components/BrandWatermark/index.tsx +39 -0
- package/src/components/BrowserIcon/components/Brave.tsx +56 -0
- package/src/components/BrowserIcon/components/Chrome.tsx +14 -0
- package/src/components/BrowserIcon/components/Chromium.tsx +14 -0
- package/src/components/BrowserIcon/components/Edge.tsx +36 -0
- package/src/components/BrowserIcon/components/Firefox.tsx +38 -0
- package/src/components/BrowserIcon/components/Opera.tsx +19 -0
- package/src/components/BrowserIcon/components/Safari.tsx +23 -0
- package/src/components/BrowserIcon/components/Samsung.tsx +21 -0
- package/src/components/BrowserIcon/index.tsx +50 -0
- package/src/components/BrowserIcon/types.ts +8 -0
- package/src/components/Cell/Divider.tsx +22 -0
- package/src/components/Cell/index.tsx +53 -0
- package/src/components/CircleLoading/index.tsx +21 -0
- package/src/components/DataStyleModal/index.tsx +64 -0
- package/src/components/Error/index.tsx +58 -0
- package/src/components/Error/sentryCaptureException.ts +9 -0
- package/src/components/FetchErrorNotification/Description.tsx +48 -0
- package/src/components/FetchErrorNotification/index.tsx +15 -0
- package/src/components/FileList/EditableFileList.tsx +47 -0
- package/src/components/FileList/FileListViewer.tsx +19 -0
- package/src/components/FileList/index.ts +2 -0
- package/src/components/FileList/type.tsx +7 -0
- package/src/components/FullscreenLoading/index.tsx +21 -0
- package/src/components/GalleyGrid/Grid.tsx +36 -0
- package/src/components/GalleyGrid/index.tsx +58 -0
- package/src/components/GalleyGrid/style.ts +24 -0
- package/src/components/GuideModal/index.tsx +77 -0
- package/src/components/GuideVideo/index.tsx +30 -0
- package/src/components/HotKeys/index.tsx +77 -0
- package/src/components/ImageItem/index.tsx +75 -0
- package/src/components/ImageItem/style.ts +1 -0
- package/src/components/ManifestPreviewer/index.tsx +30 -0
- package/src/components/Menu/index.tsx +97 -0
- package/src/components/ModelIcon/index.tsx +99 -0
- package/src/components/ModelProviderIcon/index.tsx +128 -0
- package/src/components/ModelSelect/index.tsx +163 -0
- package/src/components/ModelTag/ModelIcon.tsx +93 -0
- package/src/components/ModelTag/index.tsx +13 -0
- package/src/components/Notification/index.tsx +95 -0
- package/src/components/PageTitle/index.tsx +11 -0
- package/src/components/SafeSpacing/index.tsx +27 -0
- package/src/components/SidebarHeader/index.tsx +38 -0
- package/src/components/SkeletonLoading/index.tsx +21 -0
- package/src/components/StopLoading.tsx +38 -0
- package/src/components/StructuredData/index.tsx +12 -0
- package/src/components/client/ClientResponsiveContent/index.tsx +32 -0
- package/src/components/client/ClientResponsiveLayout.tsx +32 -0
- package/src/components/server/MobileNavLayout.tsx +62 -0
- package/src/components/server/ServerLayout.tsx +19 -0
- package/src/config/__tests__/analytics.test.ts +47 -0
- package/src/config/__tests__/app.test.ts +48 -0
- package/src/config/__tests__/client.test.ts +40 -0
- package/src/config/analytics.ts +62 -0
- package/src/config/app.ts +60 -0
- package/src/config/auth.ts +129 -0
- package/src/config/db.ts +28 -0
- package/src/config/debug.ts +22 -0
- package/src/config/featureFlags/index.ts +31 -0
- package/src/config/featureFlags/schema.test.ts +59 -0
- package/src/config/featureFlags/schema.ts +57 -0
- package/src/config/featureFlags/utils/parser.test.ts +88 -0
- package/src/config/featureFlags/utils/parser.ts +32 -0
- package/src/config/file.ts +34 -0
- package/src/config/langfuse.ts +23 -0
- package/src/config/llm.ts +168 -0
- package/src/config/modelProviders/anthropic.ts +80 -0
- package/src/config/modelProviders/azure.ts +45 -0
- package/src/config/modelProviders/baichuan.ts +55 -0
- package/src/config/modelProviders/bedrock.ts +105 -0
- package/src/config/modelProviders/deepseek.ts +26 -0
- package/src/config/modelProviders/google.ts +91 -0
- package/src/config/modelProviders/groq.ts +48 -0
- package/src/config/modelProviders/index.ts +88 -0
- package/src/config/modelProviders/minimax.ts +50 -0
- package/src/config/modelProviders/mistral.ts +49 -0
- package/src/config/modelProviders/moonshot.ts +33 -0
- package/src/config/modelProviders/ollama.ts +190 -0
- package/src/config/modelProviders/openai.ts +142 -0
- package/src/config/modelProviders/openrouter.ts +125 -0
- package/src/config/modelProviders/perplexity.ts +52 -0
- package/src/config/modelProviders/qwen.ts +58 -0
- package/src/config/modelProviders/stepfun.ts +41 -0
- package/src/config/modelProviders/togetherai.ts +79 -0
- package/src/config/modelProviders/zeroone.ts +74 -0
- package/src/config/modelProviders/zhipu.ts +64 -0
- package/src/const/auth.ts +45 -0
- package/src/const/fetch.ts +27 -1
- package/src/const/guide.ts +86 -0
- package/src/const/hotkeys.ts +5 -0
- package/src/const/layoutTokens.test.ts +11 -0
- package/src/const/layoutTokens.ts +25 -0
- package/src/const/locale.ts +12 -0
- package/src/const/market.ts +15 -0
- package/src/const/message.ts +1 -0
- package/src/const/meta.ts +8 -0
- package/src/const/plugin.ts +2 -0
- package/src/const/session.ts +25 -0
- package/src/const/settings/agent.ts +40 -0
- package/src/const/settings/common.ts +7 -0
- package/src/const/settings/index.ts +28 -0
- package/src/const/settings/llm.ts +106 -0
- package/src/const/settings/sync.ts +5 -0
- package/src/const/settings/systemAgent.ts +14 -0
- package/src/const/settings/tool.ts +5 -0
- package/src/const/settings/tts.ts +10 -0
- package/src/const/theme.ts +5 -0
- package/src/const/trace.ts +60 -0
- package/src/const/url.ts +63 -0
- package/src/const/user.ts +10 -0
- package/src/const/version.ts +6 -0
- package/src/database/client/core/__tests__/db-upgrade.test.ts +42 -0
- package/src/database/client/core/__tests__/db.test.ts +79 -0
- package/src/database/client/core/__tests__/model.test.ts +55 -0
- package/src/database/client/core/db.ts +246 -0
- package/src/database/client/core/index.ts +3 -0
- package/src/database/client/core/migrations/migrateSettingsToUser/fixtures/input.json +55 -0
- package/src/database/client/core/migrations/migrateSettingsToUser/fixtures/output.json +60 -0
- package/src/database/client/core/migrations/migrateSettingsToUser/index.test.ts +14 -0
- package/src/database/client/core/migrations/migrateSettingsToUser/index.ts +22 -0
- package/src/database/client/core/migrations/migrateSettingsToUser/type.ts +108 -0
- package/src/database/client/core/model.ts +252 -0
- package/src/database/client/core/schemas.ts +88 -0
- package/src/database/client/core/sync.ts +328 -0
- package/src/database/client/core/types/db.ts +15 -0
- package/src/database/client/models/__DEBUG.ts +124 -0
- package/src/database/client/models/__tests__/file.test.ts +83 -0
- package/src/database/client/models/__tests__/message.test.ts +414 -0
- package/src/database/client/models/__tests__/plugin.test.ts +81 -0
- package/src/database/client/models/__tests__/session.test.ts +254 -0
- package/src/database/client/models/__tests__/sessionGroup.test.ts +220 -0
- package/src/database/client/models/__tests__/topic.test.ts +523 -0
- package/src/database/client/models/__tests__/user.test.ts +82 -0
- package/src/database/client/models/file.ts +31 -0
- package/src/database/client/models/message.ts +268 -0
- package/src/database/client/models/plugin.ts +62 -0
- package/src/database/client/models/session.ts +271 -0
- package/src/database/client/models/sessionGroup.ts +90 -0
- package/src/database/client/models/topic.ts +244 -0
- package/src/database/client/models/user.ts +69 -0
- package/src/database/client/schemas/files.ts +39 -0
- package/src/database/client/schemas/message.ts +50 -0
- package/src/database/client/schemas/plugin.ts +12 -0
- package/src/database/client/schemas/session.ts +51 -0
- package/src/database/client/schemas/sessionGroup.ts +8 -0
- package/src/database/client/schemas/topic.ts +12 -0
- package/src/database/client/schemas/user.ts +40 -0
- package/src/database/server/core/db.ts +44 -0
- package/src/database/server/core/dbForTest.ts +45 -0
- package/src/database/server/index.ts +1 -0
- package/src/database/server/migrations/0000_init.sql +439 -0
- package/src/database/server/migrations/0001_add_client_id.sql +9 -0
- package/src/database/server/migrations/0002_amusing_puma.sql +9 -0
- package/src/database/server/migrations/0003_naive_echo.sql +46 -0
- package/src/database/server/migrations/meta/0000_snapshot.json +1583 -0
- package/src/database/server/migrations/meta/0001_snapshot.json +1636 -0
- package/src/database/server/migrations/meta/0002_snapshot.json +1630 -0
- package/src/database/server/migrations/meta/0003_snapshot.json +1823 -0
- package/src/database/server/migrations/meta/_journal.json +34 -0
- package/src/database/server/models/__tests__/file.test.ts +140 -0
- package/src/database/server/models/__tests__/message.test.ts +917 -0
- package/src/database/server/models/__tests__/plugin.test.ts +172 -0
- package/src/database/server/models/__tests__/session.test.ts +595 -0
- package/src/database/server/models/__tests__/topic.test.ts +623 -0
- package/src/database/server/models/__tests__/user.test.ts +173 -0
- package/src/database/server/models/_template.ts +44 -0
- package/src/database/server/models/file.ts +51 -0
- package/src/database/server/models/message.ts +388 -0
- package/src/database/server/models/plugin.ts +63 -0
- package/src/database/server/models/session.ts +291 -0
- package/src/database/server/models/sessionGroup.ts +69 -0
- package/src/database/server/models/topic.ts +265 -0
- package/src/database/server/models/user.ts +144 -0
- package/src/database/server/schemas/_id.ts +15 -0
- package/src/database/server/schemas/lobechat.ts +655 -0
- package/src/database/server/utils/idGenerator.test.ts +39 -0
- package/src/database/server/utils/idGenerator.ts +26 -0
- package/src/features/AgentInfo/index.tsx +70 -0
- package/src/features/AgentSetting/AgentChat/index.tsx +142 -0
- package/src/features/AgentSetting/AgentMeta/AutoGenerateAvatar.tsx +59 -0
- package/src/features/AgentSetting/AgentMeta/AutoGenerateInput.tsx +45 -0
- package/src/features/AgentSetting/AgentMeta/AutoGenerateSelect.tsx +50 -0
- package/src/features/AgentSetting/AgentMeta/BackgroundSwatches.tsx +27 -0
- package/src/features/AgentSetting/AgentMeta/index.tsx +132 -0
- package/src/features/AgentSetting/AgentModal/ModelSelect.tsx +20 -0
- package/src/features/AgentSetting/AgentModal/index.tsx +95 -0
- package/src/features/AgentSetting/AgentPlugin/AddPluginButton.tsx +49 -0
- package/src/features/AgentSetting/AgentPlugin/LoadingList.tsx +48 -0
- package/src/features/AgentSetting/AgentPlugin/LocalPluginItem.tsx +42 -0
- package/src/features/AgentSetting/AgentPlugin/PluginAction/index.tsx +36 -0
- package/src/features/AgentSetting/AgentPlugin/index.tsx +163 -0
- package/src/features/AgentSetting/AgentPrompt/TokenTag.tsx +39 -0
- package/src/features/AgentSetting/AgentPrompt/index.tsx +128 -0
- package/src/features/AgentSetting/AgentSettings.tsx +24 -0
- package/src/features/AgentSetting/AgentSettingsStore.tsx +14 -0
- package/src/features/AgentSetting/AgentTTS/SelectWithTTSPreview.tsx +120 -0
- package/src/features/AgentSetting/AgentTTS/index.tsx +122 -0
- package/src/features/AgentSetting/AgentTTS/options.ts +16 -0
- package/src/features/AgentSetting/StoreUpdater.tsx +32 -0
- package/src/features/AgentSetting/hooks/useAgentSettings.ts +31 -0
- package/src/features/AgentSetting/index.tsx +3 -0
- package/src/features/AgentSetting/store/action.ts +305 -0
- package/src/features/AgentSetting/store/index.ts +16 -0
- package/src/features/AgentSetting/store/initialState.ts +28 -0
- package/src/features/AgentSetting/store/reducers/config.ts +54 -0
- package/src/features/AgentSetting/store/reducers/meta.ts +21 -0
- package/src/features/AgentSetting/store/selectors.ts +11 -0
- package/src/features/AgentSetting/useSyncAgemtSettings.ts +14 -0
- package/src/features/AvatarWithUpload/index.tsx +30 -17
- package/src/features/ChatInput/ActionBar/Clear.tsx +49 -0
- package/src/features/ChatInput/ActionBar/FileUpload.tsx +69 -0
- package/src/features/ChatInput/ActionBar/History.tsx +70 -0
- package/src/features/ChatInput/ActionBar/ModelSwitch.tsx +20 -0
- package/src/features/ChatInput/ActionBar/Temperature.tsx +49 -0
- package/src/features/ChatInput/ActionBar/Token/TokenProgress.tsx +80 -0
- package/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +149 -0
- package/src/features/ChatInput/ActionBar/Token/index.tsx +18 -0
- package/src/features/ChatInput/ActionBar/Tools/Dropdown.tsx +145 -0
- package/src/features/ChatInput/ActionBar/Tools/ToolItem.tsx +45 -0
- package/src/features/ChatInput/ActionBar/Tools/index.tsx +33 -0
- package/src/features/ChatInput/ActionBar/config.ts +33 -0
- package/src/features/ChatInput/ActionBar/index.tsx +58 -0
- package/src/features/ChatInput/STT/browser.tsx +118 -0
- package/src/features/ChatInput/STT/common.tsx +120 -0
- package/src/features/ChatInput/STT/index.tsx +20 -0
- package/src/features/ChatInput/STT/openai.tsx +129 -0
- package/src/features/ChatInput/Topic/index.tsx +41 -0
- package/src/features/ChatInput/useChatInput.ts +45 -0
- package/src/features/ChatInput/useSend.ts +44 -0
- package/src/features/Conversation/Actions/Assistant.tsx +36 -0
- package/src/features/Conversation/Actions/Error.tsx +11 -0
- package/src/features/Conversation/Actions/Fallback.tsx +13 -0
- package/src/features/Conversation/Actions/Tool.tsx +28 -0
- package/src/features/Conversation/Actions/User.tsx +20 -0
- package/src/features/Conversation/Actions/customAction.ts +37 -0
- package/src/features/Conversation/Actions/index.ts +79 -0
- package/src/features/Conversation/Error/APIKeyForm/Bedrock.tsx +80 -0
- package/src/features/Conversation/Error/APIKeyForm/ProviderApiKeyForm.tsx +79 -0
- package/src/features/Conversation/Error/APIKeyForm/ProviderAvatar.tsx +89 -0
- package/src/features/Conversation/Error/APIKeyForm/index.tsx +96 -0
- package/src/features/Conversation/Error/AccessCodeForm.tsx +63 -0
- package/src/features/Conversation/Error/ClerkLogin/index.tsx +47 -0
- package/src/features/Conversation/Error/ErrorJsonViewer.tsx +26 -0
- package/src/features/Conversation/Error/InvalidAPIKey.tsx +16 -0
- package/src/features/Conversation/Error/InvalidAccessCode.tsx +79 -0
- package/src/features/Conversation/Error/OAuthForm.tsx +97 -0
- package/src/features/Conversation/Error/OllamaBizError/InvalidOllamaModel/index.tsx +154 -0
- package/src/features/Conversation/Error/OllamaBizError/InvalidOllamaModel/useDownloadMonitor.ts +29 -0
- package/src/features/Conversation/Error/OllamaBizError/SetupGuide.tsx +221 -0
- package/src/features/Conversation/Error/OllamaBizError/index.tsx +47 -0
- package/src/features/Conversation/Error/OpenAiBizError.tsx +29 -0
- package/src/features/Conversation/Error/PluginSettings.tsx +66 -0
- package/src/features/Conversation/Error/index.tsx +117 -0
- package/src/features/Conversation/Error/style.tsx +76 -0
- package/src/features/Conversation/Extras/Assistant.test.tsx +86 -0
- package/src/features/Conversation/Extras/Assistant.tsx +51 -0
- package/src/features/Conversation/Extras/ExtraContainer.tsx +13 -0
- package/src/features/Conversation/Extras/TTS/FilePlayer.tsx +25 -0
- package/src/features/Conversation/Extras/TTS/InitPlayer.tsx +93 -0
- package/src/features/Conversation/Extras/TTS/Player.tsx +61 -0
- package/src/features/Conversation/Extras/TTS/index.tsx +32 -0
- package/src/features/Conversation/Extras/Translate.tsx +72 -0
- package/src/features/Conversation/Extras/User.tsx +36 -0
- package/src/features/Conversation/Extras/index.ts +8 -0
- package/src/features/Conversation/Extras/type.ts +5 -0
- package/src/features/Conversation/Messages/Assistant/ToolCalls/index.tsx +60 -0
- package/src/features/Conversation/Messages/Assistant/ToolCalls/style.ts +25 -0
- package/src/features/Conversation/Messages/Assistant/index.tsx +51 -0
- package/src/features/Conversation/Messages/Default.tsx +19 -0
- package/src/features/Conversation/Messages/Tool/Inspector/PluginResultJSON.tsx +24 -0
- package/src/features/Conversation/Messages/Tool/Inspector/Settings.tsx +39 -0
- package/src/features/Conversation/Messages/Tool/Inspector/index.tsx +158 -0
- package/src/features/Conversation/Messages/Tool/Inspector/style.ts +26 -0
- package/src/features/Conversation/Messages/Tool/index.tsx +70 -0
- package/src/features/Conversation/Messages/User.tsx +23 -0
- package/src/features/Conversation/Messages/components/Arguments.tsx +22 -0
- package/src/features/Conversation/Messages/index.ts +38 -0
- package/src/features/Conversation/components/AutoScroll.tsx +26 -0
- package/src/features/Conversation/components/BackBottom/index.tsx +31 -0
- package/src/features/Conversation/components/BackBottom/style.ts +36 -0
- package/src/features/Conversation/components/BubblesLoading.tsx +61 -0
- package/src/features/Conversation/components/ChatItem/ActionsBar.tsx +58 -0
- package/src/features/Conversation/components/ChatItem/HistoryDivider.tsx +26 -0
- package/src/features/Conversation/components/ChatItem/index.tsx +156 -0
- package/src/features/Conversation/components/ChatList/index.tsx +21 -0
- package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +113 -0
- package/src/features/Conversation/components/InboxWelcome/QuestionSuggest.tsx +104 -0
- package/src/features/Conversation/components/InboxWelcome/index.tsx +70 -0
- package/src/features/Conversation/components/OTPInput.tsx +136 -0
- package/src/features/Conversation/components/SkeletonList.tsx +51 -0
- package/src/features/Conversation/components/VirtualizedList/index.tsx +138 -0
- package/src/features/Conversation/hooks/useChatListActionsBar.tsx +55 -0
- package/src/features/Conversation/index.tsx +30 -0
- package/src/features/Conversation/types/index.tsx +32 -0
- package/src/features/DataImporter/Error.tsx +65 -0
- package/src/features/DataImporter/FileUploading.tsx +50 -0
- package/src/features/DataImporter/Loading.tsx +125 -0
- package/src/features/DataImporter/SuccessResult.tsx +61 -0
- package/src/features/DataImporter/index.tsx +185 -0
- package/src/features/DataImporter/style.ts +17 -0
- package/src/features/DebugUI/index.tsx +36 -0
- package/src/features/FileList/EditableFileList.tsx +31 -0
- package/src/features/FileList/FileListPreviewer.tsx +17 -0
- package/src/features/FileList/index.tsx +2 -0
- package/src/features/Follow/index.tsx +64 -0
- package/src/features/MobileSwitchLoading/index.tsx +13 -0
- package/src/features/MobileTabBar/index.tsx +61 -0
- package/src/features/ModelSelect/index.tsx +69 -0
- package/src/features/ModelSwitchPanel/index.tsx +113 -0
- package/src/features/PWAInstall/index.tsx +72 -0
- package/src/features/PluginAvatar/index.tsx +28 -0
- package/src/features/PluginDetailModal/APIs.tsx +43 -0
- package/src/features/PluginDetailModal/Meta.tsx +57 -0
- package/src/features/PluginDetailModal/index.tsx +75 -0
- package/src/features/PluginDevModal/LocalForm.tsx +124 -0
- package/src/features/PluginDevModal/PluginPreview.tsx +36 -0
- package/src/features/PluginDevModal/UrlManifestForm.tsx +134 -0
- package/src/features/PluginDevModal/index.tsx +172 -0
- package/src/features/PluginSettings/PluginSettingRender.tsx +86 -0
- package/src/features/PluginSettings/index.tsx +87 -0
- package/src/features/PluginStore/AddPluginButton.tsx +47 -0
- package/src/features/PluginStore/InstalledPluginList.tsx +61 -0
- package/src/features/PluginStore/Loading.tsx +13 -0
- package/src/features/PluginStore/OnlineList.tsx +89 -0
- package/src/features/PluginStore/PluginItem/Action.tsx +116 -0
- package/src/features/PluginStore/PluginItem/EditCustomPlugin.tsx +55 -0
- package/src/features/PluginStore/PluginItem/PluginTag.tsx +58 -0
- package/src/features/PluginStore/PluginItem/index.tsx +82 -0
- package/src/features/PluginStore/index.tsx +57 -0
- package/src/features/PluginsUI/Render/BuiltinType/index.test.tsx +53 -0
- package/src/features/PluginsUI/Render/BuiltinType/index.tsx +44 -0
- package/src/features/PluginsUI/Render/DefaultType/IFrameRender/index.tsx +61 -0
- package/src/features/PluginsUI/Render/DefaultType/SystemJsRender/index.tsx +40 -0
- package/src/features/PluginsUI/Render/DefaultType/SystemJsRender/utils.ts +26 -0
- package/src/features/PluginsUI/Render/DefaultType/index.tsx +53 -0
- package/src/features/PluginsUI/Render/Loading.tsx +60 -0
- package/src/features/PluginsUI/Render/MarkdownType/index.tsx +25 -0
- package/src/features/PluginsUI/Render/StandaloneType/Iframe.tsx +163 -0
- package/src/features/PluginsUI/Render/StandaloneType/index.tsx +36 -0
- package/src/features/PluginsUI/Render/index.tsx +71 -0
- package/src/features/PluginsUI/Render/useParseContent.ts +15 -0
- package/src/features/PluginsUI/Render/utils/iframeOnReady.test.ts +75 -0
- package/src/features/PluginsUI/Render/utils/iframeOnReady.ts +25 -0
- package/src/features/PluginsUI/Render/utils/listenToPlugin.test.ts +164 -0
- package/src/features/PluginsUI/Render/utils/listenToPlugin.ts +98 -0
- package/src/features/PluginsUI/Render/utils/pluginSettings.test.ts +53 -0
- package/src/features/PluginsUI/Render/utils/pluginSettings.ts +17 -0
- package/src/features/PluginsUI/Render/utils/pluginState.test.ts +43 -0
- package/src/features/PluginsUI/Render/utils/pluginState.ts +20 -0
- package/src/features/PluginsUI/Render/utils/postMessage.test.ts +64 -0
- package/src/features/PluginsUI/Render/utils/postMessage.ts +28 -0
- package/src/features/Setting/Footer.tsx +96 -0
- package/src/features/Setting/SettingContainer.tsx +35 -0
- package/src/features/SyncStatusInspector/DisableSync.tsx +79 -0
- package/src/features/SyncStatusInspector/EnableSync.tsx +136 -0
- package/src/features/SyncStatusInspector/EnableTag.tsx +66 -0
- package/src/features/SyncStatusInspector/index.tsx +27 -0
- package/src/features/User/DataStatistics.tsx +155 -0
- package/src/features/User/PlanTag.tsx +45 -0
- package/src/features/User/UserAvatar.tsx +75 -0
- package/src/features/User/UserInfo.tsx +59 -0
- package/src/features/User/UserLoginOrSignup/Community.tsx +23 -0
- package/src/features/User/UserLoginOrSignup/index.tsx +1 -0
- package/src/features/User/UserPanel/LangButton.tsx +57 -0
- package/src/features/User/UserPanel/PanelContent.tsx +85 -0
- package/src/features/User/UserPanel/ThemeButton.tsx +70 -0
- package/src/features/User/UserPanel/UpgradeBadge.tsx +19 -0
- package/src/features/User/UserPanel/index.tsx +43 -0
- package/src/features/User/UserPanel/useMenu.tsx +239 -0
- package/src/features/User/UserPanel/useNewVersion.tsx +14 -0
- package/src/features/User/__tests__/PanelContent.test.tsx +155 -0
- package/src/features/User/__tests__/UserAvatar.test.tsx +83 -0
- package/src/features/User/__tests__/useMenu.test.tsx +146 -0
- package/src/hooks/_header.ts +23 -0
- package/src/hooks/useActiveSettingsKey.ts +20 -0
- package/src/hooks/useActiveTabKey.ts +12 -0
- package/src/hooks/useGreeting/greetingTime.ts +14 -0
- package/src/hooks/useGreeting/index.ts +16 -0
- package/src/hooks/useInterceptingRoutes.test.ts +70 -0
- package/src/hooks/useInterceptingRoutes.ts +46 -0
- package/src/hooks/useIsMobile.ts +8 -0
- package/src/hooks/useIsSubSlug.ts +12 -0
- package/src/hooks/usePWAInstall.test.ts +78 -0
- package/src/hooks/usePWAInstall.ts +39 -0
- package/src/hooks/usePlatform.test.ts +82 -0
- package/src/hooks/usePlatform.ts +32 -0
- package/src/hooks/useProviderName.ts +8 -0
- package/src/hooks/useQuery.test.ts +19 -0
- package/src/hooks/useQuery.ts +8 -0
- package/src/hooks/useQueryRoute.test.ts +86 -0
- package/src/hooks/useQueryRoute.ts +46 -0
- package/src/hooks/useSyncData.ts +50 -0
- package/src/hooks/useTTS.ts +84 -0
- package/src/hooks/useTokenCount.test.ts +41 -0
- package/src/hooks/useTokenCount.ts +20 -0
- package/src/hooks/useYamlArguments.ts +16 -0
- package/src/layout/AuthProvider/Clerk/UserUpdater.tsx +40 -0
- package/src/layout/AuthProvider/Clerk/index.tsx +26 -0
- package/src/layout/AuthProvider/Clerk/useAppearance.ts +123 -0
- package/src/layout/AuthProvider/NextAuth/UserUpdater.tsx +35 -0
- package/src/layout/AuthProvider/NextAuth/index.tsx +17 -0
- package/src/layout/AuthProvider/NoAuth/index.tsx +16 -0
- package/src/layout/AuthProvider/index.tsx +17 -0
- package/src/layout/GlobalProvider/AppTheme.tsx +127 -0
- package/src/layout/GlobalProvider/Locale.tsx +62 -0
- package/src/layout/GlobalProvider/StoreInitialization.tsx +75 -0
- package/src/layout/GlobalProvider/StyleRegistry.tsx +24 -0
- package/src/layout/GlobalProvider/index.tsx +100 -0
- package/src/libs/agent-runtime/AgentRuntime.test.ts +428 -0
- package/src/libs/agent-runtime/AgentRuntime.ts +235 -0
- package/src/libs/agent-runtime/BaseAI.ts +24 -0
- package/src/libs/agent-runtime/anthropic/index.test.ts +477 -0
- package/src/libs/agent-runtime/anthropic/index.ts +106 -0
- package/src/libs/agent-runtime/azureOpenai/index.test.ts +356 -0
- package/src/libs/agent-runtime/azureOpenai/index.ts +117 -0
- package/src/libs/agent-runtime/baichuan/index.test.ts +255 -0
- package/src/libs/agent-runtime/baichuan/index.ts +32 -0
- package/src/libs/agent-runtime/bedrock/index.test.ts +394 -0
- package/src/libs/agent-runtime/bedrock/index.ts +154 -0
- package/src/libs/agent-runtime/deepseek/index.test.ts +255 -0
- package/src/libs/agent-runtime/deepseek/index.ts +10 -0
- package/src/libs/agent-runtime/error.ts +26 -0
- package/src/libs/agent-runtime/google/index.test.ts +602 -0
- package/src/libs/agent-runtime/google/index.ts +336 -0
- package/src/libs/agent-runtime/groq/index.test.ts +320 -0
- package/src/libs/agent-runtime/groq/index.ts +25 -0
- package/src/libs/agent-runtime/index.ts +22 -0
- package/src/libs/agent-runtime/minimax/index.test.ts +275 -0
- package/src/libs/agent-runtime/minimax/index.ts +176 -0
- package/src/libs/agent-runtime/mistral/index.test.ts +331 -0
- package/src/libs/agent-runtime/mistral/index.ts +21 -0
- package/src/libs/agent-runtime/moonshot/index.test.ts +251 -0
- package/src/libs/agent-runtime/moonshot/index.ts +10 -0
- package/src/libs/agent-runtime/ollama/index.test.ts +197 -0
- package/src/libs/agent-runtime/ollama/index.ts +111 -0
- package/src/libs/agent-runtime/ollama/type.ts +8 -0
- package/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap +101 -0
- package/src/libs/agent-runtime/openai/fixtures/openai-models.json +170 -0
- package/src/libs/agent-runtime/openai/index.test.ts +245 -0
- package/src/libs/agent-runtime/openai/index.ts +10 -0
- package/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap +82 -0
- package/src/libs/agent-runtime/openrouter/fixtures/models.json +62 -0
- package/src/libs/agent-runtime/openrouter/index.test.ts +312 -0
- package/src/libs/agent-runtime/openrouter/index.ts +41 -0
- package/src/libs/agent-runtime/openrouter/type.ts +28 -0
- package/src/libs/agent-runtime/perplexity/index.test.ts +249 -0
- package/src/libs/agent-runtime/perplexity/index.ts +31 -0
- package/src/libs/agent-runtime/qwen/index.test.ts +251 -0
- package/src/libs/agent-runtime/qwen/index.ts +28 -0
- package/src/libs/agent-runtime/stepfun/index.test.ts +251 -0
- package/src/libs/agent-runtime/stepfun/index.ts +10 -0
- package/src/libs/agent-runtime/togetherai/__snapshots__/index.test.ts.snap +886 -0
- package/src/libs/agent-runtime/togetherai/fixtures/models.json +8111 -0
- package/src/libs/agent-runtime/togetherai/index.test.ts +313 -0
- package/src/libs/agent-runtime/togetherai/index.ts +47 -0
- package/src/libs/agent-runtime/togetherai/type.ts +75 -0
- package/src/libs/agent-runtime/types/chat.ts +150 -0
- package/src/libs/agent-runtime/types/index.ts +3 -0
- package/src/libs/agent-runtime/types/textToImage.ts +34 -0
- package/src/libs/agent-runtime/types/type.ts +46 -0
- package/src/libs/agent-runtime/utils/anthropicHelpers.test.ts +337 -0
- package/src/libs/agent-runtime/utils/anthropicHelpers.ts +141 -0
- package/src/libs/agent-runtime/utils/createError.ts +11 -0
- package/src/libs/agent-runtime/utils/debugStream.test.ts +70 -0
- package/src/libs/agent-runtime/utils/debugStream.ts +48 -0
- package/src/libs/agent-runtime/utils/desensitizeUrl.test.ts +47 -0
- package/src/libs/agent-runtime/utils/desensitizeUrl.ts +34 -0
- package/src/libs/agent-runtime/utils/handleOpenAIError.ts +39 -0
- package/src/libs/agent-runtime/utils/openaiCompatibleFactory/index.test.ts +717 -0
- package/src/libs/agent-runtime/utils/openaiCompatibleFactory/index.ts +294 -0
- package/src/libs/agent-runtime/utils/response.ts +12 -0
- package/src/libs/agent-runtime/utils/streams/anthropic.test.ts +427 -0
- package/src/libs/agent-runtime/utils/streams/anthropic.ts +117 -0
- package/src/libs/agent-runtime/utils/streams/azureOpenai.test.ts +537 -0
- package/src/libs/agent-runtime/utils/streams/azureOpenai.ts +89 -0
- package/src/libs/agent-runtime/utils/streams/bedrock/claude.ts +21 -0
- package/src/libs/agent-runtime/utils/streams/bedrock/common.ts +32 -0
- package/src/libs/agent-runtime/utils/streams/bedrock/index.ts +3 -0
- package/src/libs/agent-runtime/utils/streams/bedrock/llama.test.ts +196 -0
- package/src/libs/agent-runtime/utils/streams/bedrock/llama.ts +51 -0
- package/src/libs/agent-runtime/utils/streams/google-ai.test.ts +97 -0
- package/src/libs/agent-runtime/utils/streams/google-ai.ts +68 -0
- package/src/libs/agent-runtime/utils/streams/index.ts +8 -0
- package/src/libs/agent-runtime/utils/streams/minimax.ts +39 -0
- package/src/libs/agent-runtime/utils/streams/ollama.test.ts +77 -0
- package/src/libs/agent-runtime/utils/streams/ollama.ts +38 -0
- package/src/libs/agent-runtime/utils/streams/openai.test.ts +263 -0
- package/src/libs/agent-runtime/utils/streams/openai.ts +83 -0
- package/src/libs/agent-runtime/utils/streams/protocol.ts +106 -0
- package/src/libs/agent-runtime/utils/uriParser.test.ts +29 -0
- package/src/libs/agent-runtime/utils/uriParser.ts +24 -0
- package/src/libs/agent-runtime/zeroone/index.test.ts +299 -0
- package/src/libs/agent-runtime/zeroone/index.ts +11 -0
- package/src/libs/agent-runtime/zhipu/authToken.test.ts +18 -0
- package/src/libs/agent-runtime/zhipu/authToken.ts +22 -0
- package/src/libs/agent-runtime/zhipu/index.test.ts +322 -0
- package/src/libs/agent-runtime/zhipu/index.ts +130 -0
- package/src/libs/logger/index.ts +5 -0
- package/src/libs/next-auth/index.ts +46 -0
- package/src/libs/next-auth/sso-providers/auth0.ts +17 -0
- package/src/libs/next-auth/sso-providers/authentik.ts +17 -0
- package/src/libs/next-auth/sso-providers/azure-ad.ts +17 -0
- package/src/libs/next-auth/sso-providers/github.ts +15 -0
- package/src/libs/next-auth/sso-providers/index.ts +7 -0
- package/src/libs/next-auth/sso-providers/zitadel.ts +16 -0
- package/src/libs/swr/index.ts +74 -0
- package/src/libs/traces/event.test.ts +158 -0
- package/src/libs/traces/event.ts +133 -0
- package/src/libs/traces/index.test.ts +61 -0
- package/src/libs/traces/index.ts +52 -0
- package/src/libs/trpc/client.ts +65 -0
- package/src/libs/trpc/index.ts +42 -0
- package/src/libs/trpc/init.ts +26 -0
- package/src/libs/trpc/middleware/password.test.ts +88 -0
- package/src/libs/trpc/middleware/password.ts +26 -0
- package/src/libs/trpc/middleware/userAuth.test.ts +44 -0
- package/src/libs/trpc/middleware/userAuth.ts +18 -0
- package/src/locales/create.ts +51 -39
- package/src/locales/default/auth.ts +8 -0
- package/src/locales/default/chat.ts +138 -0
- package/src/locales/default/clerk.ts +782 -0
- package/src/locales/default/common.ts +214 -39
- package/src/locales/default/components.ts +16 -0
- package/src/locales/default/error.ts +134 -0
- package/src/locales/default/index.ts +35 -0
- package/src/locales/default/market.ts +32 -0
- package/src/locales/default/metadata.ts +20 -0
- package/src/locales/default/migration.ts +47 -0
- package/src/locales/default/modelProvider.ts +111 -0
- package/src/locales/default/plugin.ts +167 -0
- package/src/locales/default/portal.ts +4 -0
- package/src/locales/default/setting.ts +336 -30
- package/src/locales/default/tool.ts +10 -0
- package/src/locales/default/welcome.ts +50 -0
- package/src/locales/resources.test.ts +49 -0
- package/src/locales/resources.ts +114 -0
- package/src/middleware.ts +65 -0
- package/src/migrations/FromV0ToV1.ts +2 -4
- package/src/migrations/FromV1ToV2/fixtures/input-v1-session.json +191 -0
- package/src/migrations/FromV1ToV2/fixtures/output-v2.json +202 -0
- package/src/migrations/FromV1ToV2/index.ts +82 -0
- package/src/migrations/FromV1ToV2/migrations.test.ts +224 -0
- package/src/migrations/FromV1ToV2/types/v1.ts +78 -0
- package/src/migrations/FromV1ToV2/types/v2.ts +52 -0
- package/src/migrations/FromV2ToV3/fixtures/input-v2-session.json +72 -0
- package/src/migrations/FromV2ToV3/fixtures/output-v3-from-v1.json +203 -0
- package/src/migrations/FromV2ToV3/fixtures/output-v3.json +74 -0
- package/src/migrations/FromV2ToV3/index.ts +30 -0
- package/src/migrations/FromV2ToV3/migrations.test.ts +42 -0
- package/src/migrations/FromV2ToV3/types/v3.ts +27 -0
- package/src/migrations/FromV3ToV4/fixtures/azure-input-v3.json +79 -0
- package/src/migrations/FromV3ToV4/fixtures/azure-output-v4.json +75 -0
- package/src/migrations/FromV3ToV4/fixtures/ollama-input-v3.json +85 -0
- package/src/migrations/FromV3ToV4/fixtures/ollama-output-v4.json +85 -0
- package/src/migrations/FromV3ToV4/fixtures/openai-input-v3.json +77 -0
- package/src/migrations/FromV3ToV4/fixtures/openai-output-v4.json +77 -0
- package/src/migrations/FromV3ToV4/fixtures/openrouter-input-v3.json +82 -0
- package/src/migrations/FromV3ToV4/fixtures/openrouter-output-v4.json +85 -0
- package/src/migrations/FromV3ToV4/fixtures/output-v4-from-v1.json +203 -0
- package/src/migrations/FromV3ToV4/index.ts +102 -0
- package/src/migrations/FromV3ToV4/migrations.test.ts +195 -0
- package/src/migrations/FromV3ToV4/types/v3.ts +52 -0
- package/src/migrations/FromV3ToV4/types/v4.ts +37 -0
- package/src/migrations/FromV4ToV5/fixtures/from-v1-to-v5-output.json +245 -0
- package/src/migrations/FromV4ToV5/fixtures/function-input-v4.json +96 -0
- package/src/migrations/FromV4ToV5/fixtures/function-output-v5.json +120 -0
- package/src/migrations/FromV4ToV5/index.ts +58 -0
- package/src/migrations/FromV4ToV5/migrations.test.ts +49 -0
- package/src/migrations/FromV4ToV5/types/v4.ts +21 -0
- package/src/migrations/FromV4ToV5/types/v5.ts +27 -0
- package/src/migrations/FromV5ToV6/fixtures/from-v1-to-v6-output.json +247 -0
- package/src/migrations/FromV5ToV6/fixtures/session-input-v5.json +81 -0
- package/src/migrations/FromV5ToV6/fixtures/session-output-v6.json +85 -0
- package/src/migrations/FromV5ToV6/index.ts +61 -0
- package/src/migrations/FromV5ToV6/migrations.test.ts +50 -0
- package/src/migrations/FromV5ToV6/types/v5.ts +48 -0
- package/src/migrations/FromV5ToV6/types/v6.ts +60 -0
- package/src/migrations/FromV6ToV7/fixtures/output-v7-from-v1.json +203 -0
- package/src/migrations/FromV6ToV7/fixtures/provider-input-v6.json +103 -0
- package/src/migrations/FromV6ToV7/fixtures/provider-output-v7.json +118 -0
- package/src/migrations/FromV6ToV7/index.ts +101 -0
- package/src/migrations/FromV6ToV7/migrations.test.ts +64 -0
- package/src/migrations/FromV6ToV7/types/v6.ts +61 -0
- package/src/migrations/FromV6ToV7/types/v7.ts +71 -0
- package/src/migrations/VersionController.test.ts +88 -0
- package/src/migrations/VersionController.ts +67 -0
- package/src/migrations/index.ts +55 -7
- package/src/server/context.ts +51 -0
- package/src/server/files/s3.ts +78 -0
- package/src/server/globalConfig/index.ts +136 -0
- package/src/server/globalConfig/parseDefaultAgent.test.ts +195 -0
- package/src/server/globalConfig/parseDefaultAgent.ts +47 -0
- package/src/server/globalConfig/parseSystemAgent.test.ts +95 -0
- package/src/server/globalConfig/parseSystemAgent.ts +39 -0
- package/src/server/keyVaultsEncrypt/index.test.ts +62 -0
- package/src/server/keyVaultsEncrypt/index.ts +93 -0
- package/src/server/ld.ts +218 -0
- package/src/server/metadata.ts +96 -0
- package/src/server/mock.ts +8 -0
- package/src/server/modules/DataImporter/__tests__/fixtures/messages.json +1101 -0
- package/src/server/modules/DataImporter/__tests__/index.test.ts +954 -0
- package/src/server/modules/DataImporter/index.ts +333 -0
- package/src/server/routers/edge/config/__snapshots__/index.test.ts.snap +112 -0
- package/src/server/routers/edge/config/index.test.ts +181 -0
- package/src/server/routers/edge/config/index.ts +12 -0
- package/src/server/routers/edge/index.ts +15 -0
- package/src/server/routers/edge/upload.ts +16 -0
- package/src/server/routers/lambda/file.ts +49 -0
- package/src/server/routers/lambda/importer.ts +52 -0
- package/src/server/routers/lambda/index.ts +28 -0
- package/src/server/routers/lambda/message.ts +177 -0
- package/src/server/routers/lambda/plugin.ts +100 -0
- package/src/server/routers/lambda/session.ts +194 -0
- package/src/server/routers/lambda/sessionGroup.ts +77 -0
- package/src/server/routers/lambda/topic.ts +134 -0
- package/src/server/routers/lambda/user.ts +98 -0
- package/src/server/routers/tools/index.ts +7 -0
- package/src/server/services/user/index.ts +96 -0
- package/src/server/translation.ts +44 -0
- package/src/services/__tests__/__snapshots__/chat.test.ts.snap +116 -0
- package/src/services/__tests__/__snapshots__/tool.test.ts.snap +204 -0
- package/src/services/__tests__/chat.test.ts +966 -0
- package/src/services/__tests__/global.test.ts +100 -0
- package/src/services/__tests__/ollama.test.ts +28 -0
- package/src/services/__tests__/openai/OpenAPI_V3.json +245 -0
- package/src/services/__tests__/openai/plugin.json +22 -0
- package/src/services/__tests__/share.test.ts +131 -0
- package/src/services/__tests__/sync.test.ts +56 -0
- package/src/services/__tests__/tool.test.ts +268 -0
- package/src/services/__tests__/upload.test.ts +72 -0
- package/src/services/_auth.test.ts +192 -0
- package/src/services/_auth.ts +75 -0
- package/src/services/_header.ts +20 -0
- package/src/services/_url.ts +46 -0
- package/src/services/chat.ts +528 -0
- package/src/services/config.ts +159 -0
- package/src/services/debug.ts +40 -0
- package/src/services/file/client.test.ts +160 -0
- package/src/services/file/client.ts +65 -0
- package/src/services/file/index.ts +6 -0
- package/src/services/file/server.ts +45 -0
- package/src/services/file/type.ts +9 -0
- package/src/services/github.ts +42 -0
- package/src/services/global.ts +29 -0
- package/src/services/import/client.ts +74 -0
- package/src/services/import/index.ts +6 -0
- package/src/services/import/server.ts +115 -0
- package/src/services/market.ts +22 -0
- package/src/services/message/client.test.ts +384 -0
- package/src/services/message/client.ts +89 -0
- package/src/services/message/index.test.ts +48 -0
- package/src/services/message/index.ts +8 -0
- package/src/services/message/server.ts +106 -0
- package/src/services/message/type.ts +46 -0
- package/src/services/models.ts +37 -0
- package/src/services/ollama.ts +83 -0
- package/src/services/plugin/client.test.ts +162 -0
- package/src/services/plugin/client.ts +42 -0
- package/src/services/plugin/index.ts +6 -0
- package/src/services/plugin/server.ts +46 -0
- package/src/services/plugin/type.ts +21 -0
- package/src/services/session/client.test.ts +439 -0
- package/src/services/session/client.ts +180 -0
- package/src/services/session/index.ts +6 -0
- package/src/services/session/server.ts +148 -0
- package/src/services/session/type.ts +65 -0
- package/src/services/share.ts +61 -0
- package/src/services/sync.ts +19 -0
- package/src/services/textToImage.ts +36 -0
- package/src/services/tool.ts +144 -0
- package/src/services/topic/client.test.ts +245 -0
- package/src/services/topic/client.ts +70 -0
- package/src/services/topic/index.ts +6 -0
- package/src/services/topic/server.ts +68 -0
- package/src/services/topic/type.ts +34 -0
- package/src/services/trace.ts +28 -0
- package/src/services/upload.ts +99 -0
- package/src/services/user/client.test.ts +102 -0
- package/src/services/user/client.ts +52 -0
- package/src/services/user/index.ts +6 -0
- package/src/services/user/server.ts +28 -0
- package/src/services/user/type.ts +11 -0
- package/src/store/agent/index.ts +2 -0
- package/src/store/agent/initialState.ts +7 -0
- package/src/store/agent/selectors.ts +1 -0
- package/src/store/agent/slices/chat/__snapshots__/selectors.test.ts.snap +30 -0
- package/src/store/agent/slices/chat/action.test.ts +305 -0
- package/src/store/agent/slices/chat/action.ts +176 -0
- package/src/store/agent/slices/chat/index.ts +2 -0
- package/src/store/agent/slices/chat/initialState.ts +22 -0
- package/src/store/agent/slices/chat/selectors.test.ts +227 -0
- package/src/store/agent/slices/chat/selectors.ts +98 -0
- package/src/store/agent/store.ts +22 -0
- package/src/store/chat/helpers.test.ts +109 -0
- package/src/store/chat/helpers.ts +30 -0
- package/src/store/chat/index.ts +3 -0
- package/src/store/chat/initialState.ts +22 -0
- package/src/store/chat/selectors.ts +4 -0
- package/src/store/chat/slices/builtinTool/action.test.ts +104 -0
- package/src/store/chat/slices/builtinTool/action.ts +101 -0
- package/src/store/chat/slices/builtinTool/initialState.ts +7 -0
- package/src/store/chat/slices/builtinTool/selectors.ts +11 -0
- package/src/store/chat/slices/enchance/action.test.ts +126 -0
- package/src/store/chat/slices/enchance/action.ts +124 -0
- package/src/store/chat/slices/message/action.test.ts +1243 -0
- package/src/store/chat/slices/message/action.ts +765 -0
- package/src/store/chat/slices/message/initialState.ts +47 -0
- package/src/store/chat/slices/message/reducer.test.ts +306 -0
- package/src/store/chat/slices/message/reducer.ts +154 -0
- package/src/store/chat/slices/message/selectors.test.ts +424 -0
- package/src/store/chat/slices/message/selectors.ts +171 -0
- package/src/store/chat/slices/message/utils.ts +7 -0
- package/src/store/chat/slices/plugin/action.test.ts +967 -0
- package/src/store/chat/slices/plugin/action.ts +371 -0
- package/src/store/chat/slices/portal/action.test.ts +109 -0
- package/src/store/chat/slices/portal/action.ts +31 -0
- package/src/store/chat/slices/portal/initialState.ts +8 -0
- package/src/store/chat/slices/portal/selectors.test.ts +73 -0
- package/src/store/chat/slices/portal/selectors.ts +15 -0
- package/src/store/chat/slices/share/action.test.ts +213 -0
- package/src/store/chat/slices/share/action.ts +122 -0
- package/src/store/chat/slices/share/initialState.ts +7 -0
- package/src/store/chat/slices/topic/action.test.ts +540 -0
- package/src/store/chat/slices/topic/action.ts +330 -0
- package/src/store/chat/slices/topic/initialState.ts +28 -0
- package/src/store/chat/slices/topic/reducer.test.ts +139 -0
- package/src/store/chat/slices/topic/reducer.ts +67 -0
- package/src/store/chat/slices/topic/selectors.test.ts +95 -0
- package/src/store/chat/slices/topic/selectors.ts +35 -0
- package/src/store/chat/store.ts +50 -0
- package/src/store/chat/utils/index.ts +19 -0
- package/src/store/file/index.ts +2 -0
- package/src/store/file/initialState.ts +7 -0
- package/src/store/file/selectors.ts +7 -0
- package/src/store/file/slices/images/action.test.ts +184 -0
- package/src/store/file/slices/images/action.ts +153 -0
- package/src/store/file/slices/images/initialState.ts +13 -0
- package/src/store/file/slices/images/selectors.test.ts +78 -0
- package/src/store/file/slices/images/selectors.ts +40 -0
- package/src/store/file/slices/tts/action.test.ts +141 -0
- package/src/store/file/slices/tts/action.ts +63 -0
- package/src/store/file/slices/tts/index.ts +2 -0
- package/src/store/file/slices/tts/selectors.ts +3 -0
- package/src/store/file/store.ts +23 -0
- package/src/store/global/action.test.ts +183 -0
- package/src/store/global/action.ts +107 -0
- package/src/store/global/index.ts +1 -0
- package/src/store/global/initialState.ts +72 -0
- package/src/store/global/selectors.ts +26 -0
- package/src/store/global/store.ts +26 -0
- package/src/store/market/action.ts +82 -0
- package/src/store/market/index.ts +3 -0
- package/src/store/market/initialState.ts +19 -0
- package/src/store/market/selectors.ts +38 -0
- package/src/store/market/store.ts +48 -0
- package/src/store/middleware/createDevtools.ts +23 -0
- package/src/store/middleware/createHyperStorage/index.test.ts +341 -0
- package/src/store/middleware/createHyperStorage/index.ts +126 -0
- package/src/store/middleware/createHyperStorage/indexedDB.test.ts +64 -0
- package/src/store/middleware/createHyperStorage/indexedDB.ts +26 -0
- package/src/store/middleware/createHyperStorage/keyMapper.ts +57 -0
- package/src/store/middleware/createHyperStorage/localStorage.ts +18 -0
- package/src/store/middleware/createHyperStorage/type.ts +25 -0
- package/src/store/middleware/createHyperStorage/urlStorage.test.ts +84 -0
- package/src/store/middleware/createHyperStorage/urlStorage.ts +81 -0
- package/src/store/serverConfig/Provider.tsx +23 -0
- package/src/store/serverConfig/index.ts +3 -0
- package/src/store/serverConfig/selectors.test.ts +74 -0
- package/src/store/serverConfig/selectors.ts +14 -0
- package/src/store/serverConfig/store.test.ts +53 -0
- package/src/store/serverConfig/store.ts +66 -0
- package/src/store/session/helpers.ts +1 -0
- package/src/store/session/index.ts +1 -32
- package/src/store/session/initialState.ts +4 -6
- package/src/store/session/selectors.ts +2 -3
- package/src/store/session/slices/session/action.test.ts +232 -0
- package/src/store/session/slices/session/action.ts +226 -70
- package/src/store/session/slices/session/helpers.ts +17 -0
- package/src/store/session/slices/session/initialState.ts +18 -19
- package/src/store/session/slices/session/reducers.test.ts +79 -0
- package/src/store/session/slices/session/reducers.ts +61 -0
- package/src/store/session/slices/session/selectors/index.ts +2 -20
- package/src/store/session/slices/session/selectors/list.test.ts +126 -0
- package/src/store/session/slices/session/selectors/list.ts +45 -51
- package/src/store/session/slices/session/selectors/meta.test.ts +108 -0
- package/src/store/session/slices/session/selectors/meta.ts +45 -0
- package/src/store/session/slices/sessionGroup/action.test.ts +133 -0
- package/src/store/session/slices/sessionGroup/action.ts +73 -0
- package/src/store/session/slices/sessionGroup/initialState.ts +12 -0
- package/src/store/session/slices/sessionGroup/reducer.test.ts +86 -0
- package/src/store/session/slices/sessionGroup/reducer.ts +56 -0
- package/src/store/session/slices/sessionGroup/selectors.ts +11 -0
- package/src/store/session/store.ts +25 -9
- package/src/store/tool/helpers.ts +28 -0
- package/src/store/tool/index.ts +2 -0
- package/src/store/tool/initialState.ts +13 -0
- package/src/store/tool/selectors/index.ts +5 -0
- package/src/store/tool/selectors/tool.test.ts +247 -0
- package/src/store/tool/selectors/tool.ts +123 -0
- package/src/store/tool/slices/builtin/action.test.ts +87 -0
- package/src/store/tool/slices/builtin/action.ts +54 -0
- package/src/store/tool/slices/builtin/index.ts +2 -0
- package/src/store/tool/slices/builtin/initialState.ts +12 -0
- package/src/store/tool/slices/builtin/selectors.test.ts +53 -0
- package/src/store/tool/slices/builtin/selectors.ts +20 -0
- package/src/store/tool/slices/customPlugin/action.test.ts +141 -0
- package/src/store/tool/slices/customPlugin/action.ts +88 -0
- package/src/store/tool/slices/customPlugin/index.ts +3 -0
- package/src/store/tool/slices/customPlugin/initialState.ts +17 -0
- package/src/store/tool/slices/customPlugin/reducers/customPluginList.ts +56 -0
- package/src/store/tool/slices/customPlugin/selectors.test.ts +70 -0
- package/src/store/tool/slices/customPlugin/selectors.ts +9 -0
- package/src/store/tool/slices/plugin/__snapshots__/action.test.ts.snap +15 -0
- package/src/store/tool/slices/plugin/action.test.ts +196 -0
- package/src/store/tool/slices/plugin/action.ts +76 -0
- package/src/store/tool/slices/plugin/index.ts +3 -0
- package/src/store/tool/slices/plugin/initialState.ts +16 -0
- package/src/store/tool/slices/plugin/reducers/manifest.ts +36 -0
- package/src/store/tool/slices/plugin/selectors.test.ts +197 -0
- package/src/store/tool/slices/plugin/selectors.ts +80 -0
- package/src/store/tool/slices/store/action.test.ts +392 -0
- package/src/store/tool/slices/store/action.ts +112 -0
- package/src/store/tool/slices/store/index.ts +3 -0
- package/src/store/tool/slices/store/initialState.ts +17 -0
- package/src/store/tool/slices/store/selectors.test.ts +50 -0
- package/src/store/tool/slices/store/selectors.ts +32 -0
- package/src/store/tool/store.ts +32 -0
- package/src/store/user/helpers.ts +9 -0
- package/src/store/user/index.ts +1 -0
- package/src/store/user/initialState.ts +22 -0
- package/src/store/user/selectors.ts +13 -0
- package/src/store/user/slices/auth/action.test.ts +202 -0
- package/src/store/user/slices/auth/action.ts +63 -0
- package/src/store/user/slices/auth/initialState.ts +28 -0
- package/src/store/user/slices/auth/selectors.test.ts +143 -0
- package/src/store/user/slices/auth/selectors.ts +48 -0
- package/src/store/user/slices/common/action.test.ts +271 -0
- package/src/store/user/slices/common/action.ts +129 -0
- package/src/store/user/slices/common/initialState.ts +15 -0
- package/src/store/user/slices/modelList/action.test.ts +363 -0
- package/src/store/user/slices/modelList/action.ts +209 -0
- package/src/store/user/slices/modelList/initialState.ts +15 -0
- package/src/store/user/slices/modelList/reducers/customModelCard.test.ts +204 -0
- package/src/store/user/slices/modelList/reducers/customModelCard.ts +64 -0
- package/src/store/user/slices/modelList/selectors/index.ts +3 -0
- package/src/store/user/slices/modelList/selectors/keyVaults.test.ts +201 -0
- package/src/store/user/slices/modelList/selectors/keyVaults.ts +45 -0
- package/src/store/user/slices/modelList/selectors/modelConfig.test.ts +200 -0
- package/src/store/user/slices/modelList/selectors/modelConfig.ts +85 -0
- package/src/store/user/slices/modelList/selectors/modelProvider.test.ts +145 -0
- package/src/store/user/slices/modelList/selectors/modelProvider.ts +147 -0
- package/src/store/user/slices/preference/action.test.ts +43 -0
- package/src/store/user/slices/preference/action.ts +35 -0
- package/src/store/user/slices/preference/initialState.ts +13 -0
- package/src/store/user/slices/preference/selectors.test.ts +82 -0
- package/src/store/user/slices/preference/selectors.ts +19 -0
- package/src/store/user/slices/settings/action.test.ts +153 -0
- package/src/store/user/slices/settings/action.ts +115 -0
- package/src/store/user/slices/settings/initialState.ts +15 -0
- package/src/store/user/slices/settings/selectors/__snapshots__/settings.test.ts.snap +109 -0
- package/src/store/user/slices/settings/selectors/general.test.ts +45 -0
- package/src/store/user/slices/settings/selectors/general.ts +40 -0
- package/src/store/user/slices/settings/selectors/index.ts +3 -0
- package/src/store/user/slices/settings/selectors/settings.test.ts +156 -0
- package/src/store/user/slices/settings/selectors/settings.ts +52 -0
- package/src/store/user/slices/settings/selectors/systemAgent.ts +18 -0
- package/src/store/user/slices/sync/action.test.ts +164 -0
- package/src/store/user/slices/sync/action.ts +97 -0
- package/src/store/user/slices/sync/initialState.ts +13 -0
- package/src/store/user/slices/sync/selectors.ts +20 -0
- package/src/store/user/store.ts +42 -0
- package/src/styles/antdOverride.ts +8 -23
- package/src/styles/global.ts +39 -14
- package/src/styles/index.ts +6 -1
- package/src/styles/mobileHeader.ts +15 -0
- package/src/tools/dalle/Render/Item/EditMode.tsx +66 -0
- package/src/tools/dalle/Render/Item/Error.tsx +50 -0
- package/src/tools/dalle/Render/Item/Image.tsx +44 -0
- package/src/tools/dalle/Render/Item/ImageFileItem.tsx +77 -0
- package/src/tools/dalle/Render/Item/index.tsx +88 -0
- package/src/tools/dalle/Render/ToolBar.tsx +55 -0
- package/src/tools/dalle/Render/index.tsx +51 -0
- package/src/tools/dalle/index.ts +92 -0
- package/src/tools/index.ts +11 -0
- package/src/tools/portals.ts +3 -0
- package/src/tools/renders.ts +14 -0
- package/src/types/agent/index.ts +83 -0
- package/src/types/exportConfig.ts +119 -19
- package/src/types/fetch.ts +36 -0
- package/src/types/files.ts +42 -0
- package/src/types/i18next.d.ts +1 -1
- package/src/types/importer.ts +128 -0
- package/src/types/llm.ts +92 -12
- package/src/types/locale.ts +4 -0
- package/src/types/market.ts +20 -0
- package/src/types/message/index.ts +82 -0
- package/src/types/message/tools.ts +65 -0
- package/src/types/message/translate.ts +4 -0
- package/src/types/meta.ts +24 -12
- package/src/types/next-auth.d.ts +23 -0
- package/src/types/openai/chat.ts +128 -0
- package/src/types/openai/functionCall.ts +10 -0
- package/src/types/openai/image.ts +34 -0
- package/src/types/openai/plugin.ts +57 -0
- package/src/types/serverConfig.ts +32 -0
- package/src/types/service.ts +7 -0
- package/src/types/session/agentSession.ts +35 -0
- package/src/types/session/index.ts +10 -0
- package/src/types/session/sessionGroup.ts +24 -0
- package/src/types/share.ts +7 -0
- package/src/types/sync.ts +41 -0
- package/src/types/tool/builtin.ts +47 -0
- package/src/types/tool/dalle.ts +12 -0
- package/src/types/tool/index.ts +16 -0
- package/src/types/tool/plugin.ts +35 -0
- package/src/types/tool/tool.ts +10 -0
- package/src/types/topic.ts +9 -0
- package/src/types/trace/action.ts +31 -0
- package/src/types/trace/index.ts +1 -0
- package/src/types/user/index.ts +44 -0
- package/src/types/user/settings/general.ts +12 -0
- package/src/types/user/settings/index.ts +32 -0
- package/src/types/user/settings/keyVaults.ts +40 -0
- package/src/types/user/settings/modelProvider.ts +34 -0
- package/src/types/user/settings/sync.ts +10 -0
- package/src/types/user/settings/systemAgent.ts +12 -0
- package/src/types/user/settings/tool.ts +5 -0
- package/src/types/user/settings/tts.ts +10 -0
- package/src/utils/__snapshots__/parseModels.test.ts.snap +63 -0
- package/src/utils/basePath.ts +3 -0
- package/src/utils/client/switchLang.test.ts +34 -0
- package/src/utils/client/switchLang.ts +10 -0
- package/src/utils/compass.ts +1 -5
- package/src/utils/compressImage.test.ts +59 -0
- package/src/utils/compressImage.ts +29 -0
- package/src/utils/config.ts +108 -0
- package/src/utils/cookie.ts +10 -0
- package/src/utils/difference.test.ts +46 -0
- package/src/utils/difference.ts +26 -0
- package/src/utils/env.ts +3 -0
- package/src/utils/fetch.test.ts +534 -0
- package/src/utils/fetch.ts +371 -105
- package/src/utils/filter.ts +1 -1
- package/src/utils/format.test.ts +75 -0
- package/src/utils/format.ts +48 -0
- package/src/utils/genOG.ts +20 -0
- package/src/utils/imageToBase64.ts +37 -0
- package/src/utils/jwt.test.ts +27 -0
- package/src/utils/jwt.ts +37 -0
- package/src/utils/keyboard.ts +13 -0
- package/src/utils/localStorage.ts +38 -0
- package/src/utils/locale.ts +16 -0
- package/src/utils/merge.ts +11 -0
- package/src/utils/parseMarkdown.ts +9 -0
- package/src/utils/parseModels.test.ts +290 -0
- package/src/utils/parseModels.ts +156 -0
- package/src/utils/platform.test.ts +83 -0
- package/src/utils/platform.ts +55 -0
- package/src/utils/responsive.ts +40 -0
- package/src/utils/safeParseJSON.test.ts +71 -0
- package/src/utils/safeParseJSON.ts +12 -0
- package/src/utils/storeDebug.ts +11 -0
- package/src/utils/tokenizer.ts +5 -0
- package/src/utils/toolCall.ts +21 -0
- package/src/utils/trace.ts +21 -0
- package/src/utils/url.test.ts +51 -0
- package/src/utils/url.ts +23 -0
- package/src/utils/uuid.ts +4 -4
- package/src/utils/zustand.ts +8 -0
- package/tests/setup-db.ts +7 -0
- package/tests/setup.ts +35 -0
- package/tests/utils.tsx +11 -0
- package/tsconfig.json +19 -4
- package/vercel.json +3 -0
- package/vitest.config.ts +33 -3
- package/vitest.server.config.ts +23 -0
- package/.github/ISSUE_TEMPLATE/3_question.yml +0 -15
- package/.github/ISSUE_TEMPLATE/4_other.md +0 -7
- package/.github/dependabot.yml +0 -17
- package/.github/workflows/auto-merge.yml +0 -32
- package/.github/workflows/contributor-help.yml +0 -29
- package/.github/workflows/issue-check-inactive.yml +0 -22
- package/.github/workflows/issue-remove-inactive.yml +0 -25
- package/.gitpod.yml +0 -3
- package/.husky/commit-msg +0 -4
- package/locales/en_US/common.json +0 -41
- package/locales/en_US/setting.json +0 -109
- package/locales/zh_CN/common.json +0 -41
- package/locales/zh_CN/setting.json +0 -109
- package/public/next.svg +0 -1
- package/public/vercel.svg +0 -1
- package/scripts/genDefaultLocale.ts +0 -18
- package/scripts/genResources.ts +0 -51
- package/scripts/toc.ts +0 -7
- package/src/const/modelTokens.ts +0 -8
- package/src/features/FolderPanel/index.tsx +0 -55
- package/src/features/SideBar/index.tsx +0 -35
- package/src/helpers/prompt.test.ts +0 -36
- package/src/helpers/prompt.ts +0 -36
- package/src/layout/index.tsx +0 -57
- package/src/layout/style.ts +0 -18
- package/src/locales/index.ts +0 -5
- package/src/locales/options.ts +0 -19
- package/src/locales/resources/en_US.ts +0 -7
- package/src/locales/resources/index.ts +0 -13
- package/src/locales/resources/zh_CN.ts +0 -9
- package/src/pages/_app.page.tsx +0 -13
- package/src/pages/_document.page.tsx +0 -70
- package/src/pages/api/LangChainStream.ts +0 -95
- package/src/pages/api/chain.api.ts +0 -17
- package/src/pages/api/openai.api.ts +0 -31
- package/src/pages/chat/SessionList/Header.tsx +0 -56
- package/src/pages/chat/SessionList/List/SessionItem.tsx +0 -90
- package/src/pages/chat/SessionList/List/index.tsx +0 -31
- package/src/pages/chat/SessionList/List/style.ts +0 -77
- package/src/pages/chat/SessionList/index.tsx +0 -18
- package/src/pages/chat/[id]/Config/ConfigCell.tsx +0 -68
- package/src/pages/chat/[id]/Config/ReadMode.tsx +0 -63
- package/src/pages/chat/[id]/Config/index.tsx +0 -79
- package/src/pages/chat/[id]/Conversation/ChatList.tsx +0 -36
- package/src/pages/chat/[id]/Conversation/Input.tsx +0 -61
- package/src/pages/chat/[id]/Conversation/index.tsx +0 -32
- package/src/pages/chat/[id]/Header.tsx +0 -86
- package/src/pages/chat/[id]/edit/AgentConfig.tsx +0 -95
- package/src/pages/chat/[id]/edit/AgentMeta.tsx +0 -117
- package/src/pages/chat/[id]/edit/FormItem.tsx +0 -26
- package/src/pages/chat/[id]/edit/Prompt.tsx +0 -68
- package/src/pages/chat/[id]/edit/index.page.tsx +0 -62
- package/src/pages/chat/[id]/edit/style.ts +0 -42
- package/src/pages/chat/[id]/index.page.tsx +0 -40
- package/src/pages/chat/index.page.tsx +0 -1
- package/src/pages/chat/layout.tsx +0 -51
- package/src/pages/index.page.tsx +0 -1
- package/src/pages/setting/Header.tsx +0 -27
- package/src/pages/setting/SettingForm.tsx +0 -96
- package/src/pages/setting/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -33
- package/src/pages/setting/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -33
- package/src/pages/setting/index.page.tsx +0 -41
- package/src/prompts/agent.ts +0 -65
- package/src/services/chatModel.ts +0 -34
- package/src/services/langChain.ts +0 -18
- package/src/services/url.ts +0 -8
- package/src/store/middleware/createHashStorage.ts +0 -49
- package/src/store/session/slices/agentConfig/action.ts +0 -226
- package/src/store/session/slices/agentConfig/initialState.ts +0 -34
- package/src/store/session/slices/agentConfig/selectors.ts +0 -54
- package/src/store/session/slices/chat/action.ts +0 -210
- package/src/store/session/slices/chat/index.ts +0 -3
- package/src/store/session/slices/chat/initialState.ts +0 -12
- package/src/store/session/slices/chat/messageReducer.test.ts +0 -70
- package/src/store/session/slices/chat/messageReducer.ts +0 -84
- package/src/store/session/slices/chat/selectors.ts +0 -83
- package/src/store/session/slices/session/index.ts +0 -3
- package/src/store/session/slices/session/reducers/session.test.ts +0 -456
- package/src/store/session/slices/session/reducers/session.ts +0 -113
- package/src/store/session/slices/session/selectors/chat.ts +0 -4
- package/src/store/settings/action.ts +0 -36
- package/src/store/settings/index.ts +0 -23
- package/src/store/settings/initialState.ts +0 -27
- package/src/store/settings/selectors.ts +0 -17
- package/src/store/settings/store.ts +0 -13
- package/src/types/chatMessage.ts +0 -46
- package/src/types/langchain.ts +0 -34
- package/src/types/openai.ts +0 -62
- package/src/types/session.ts +0 -59
- package/src/utils/VersionController.test.ts +0 -90
- package/src/utils/VersionController.ts +0 -64
- /package/src/{pages/setting → app/(main)/settings/common/features/Theme}/ThemeSwatches/index.ts +0 -0
- /package/src/store/{session/slices/agentConfig → file/slices/images}/index.ts +0 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: LobeChat Plugin Development Guide
|
|
3
|
+
description: >-
|
|
4
|
+
Learn how to create and integrate custom plugins in LobeChat, including plugin
|
|
5
|
+
composition, custom plugin workflow, local plugin development, manifest
|
|
6
|
+
structure, project structure, server-side implementation, plugin UI interface,
|
|
7
|
+
deployment, and release.
|
|
8
|
+
tags:
|
|
9
|
+
- Plugin Development
|
|
10
|
+
- LobeChat
|
|
11
|
+
- Custom Plugins
|
|
12
|
+
- Plugin Workflow
|
|
13
|
+
- Manifest Structure
|
|
14
|
+
- Server-side Implementation
|
|
15
|
+
- Plugin UI Interface
|
|
16
|
+
- Deployment
|
|
17
|
+
- Release
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Plugin Development Guide
|
|
21
|
+
|
|
22
|
+
## Plugin Composition
|
|
23
|
+
|
|
24
|
+
A LobeChat plugin consists of the following components:
|
|
25
|
+
|
|
26
|
+
1. **Plugin Index**: Used to display basic information about the plugin, including the plugin name, description, author, version, and a link to the plugin manifest. The official plugin index can be found at [lobe-chat-plugins](https://github.com/lobehub/lobe-chat-plugins). If you want to publish a plugin to the official plugin marketplace, you need to [submit a PR](https://github.com/lobehub/lobe-chat-plugins/pulls) to this repository.
|
|
27
|
+
2. **Plugin Manifest**: Used to describe the functionality of the plugin, including the server-side description, frontend display information, and version number. For a detailed introduction to the manifest, see [manifest][manifest-docs-url].
|
|
28
|
+
3. **Plugin Services**: Used to implement the server-side and frontend modules described in the plugin manifest, as follows:
|
|
29
|
+
- **Server-side**: Needs to implement the interface capabilities described in the `api` section of the manifest.
|
|
30
|
+
- **Frontend UI** (optional): Needs to implement the interface described in the `ui` section of the manifest. This interface will be displayed in plugin messages, allowing for a richer display of information than plain text.
|
|
31
|
+
|
|
32
|
+
## Custom Plugin Workflow
|
|
33
|
+
|
|
34
|
+
This section will introduce how to add and use a custom plugin in LobeChat.
|
|
35
|
+
|
|
36
|
+
<Steps>
|
|
37
|
+
### Create and Launch Plugin Project
|
|
38
|
+
|
|
39
|
+
You need to first create a plugin project locally, you can use the template we have prepared [lobe-chat-plugin-template][lobe-chat-plugin-template-url]
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
$ git clone https://github.com/lobehub/chat-plugin-template.git
|
|
43
|
+
$ cd chat-plugin-template
|
|
44
|
+
$ npm i
|
|
45
|
+
$ npm run dev
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
When you see `ready started server on 0.0.0.0:3400, url: http://localhost:3400`, it means the plugin service has been successfully launched locally.
|
|
49
|
+
|
|
50
|
+
<Image
|
|
51
|
+
alt="Create and Launch Plugin Project"
|
|
52
|
+
height={483}
|
|
53
|
+
inStep
|
|
54
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259526-9ef25272-4312-429b-93bc-a95515727ed3.png"
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
### Add Local Plugin in LobeChat Role Settings
|
|
58
|
+
|
|
59
|
+
Next, go to LobeChat, create a new assistant, and go to its session settings page:
|
|
60
|
+
|
|
61
|
+
<Image
|
|
62
|
+
alt="Add Local Plugin in LobeChat Role Settings S1"
|
|
63
|
+
height={483}
|
|
64
|
+
inStep
|
|
65
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259643-1a9cc34a-76f3-4ccf-928b-129654670efd.png"
|
|
66
|
+
/>
|
|
67
|
+
|
|
68
|
+
Click the <kbd>Add</kbd> button on the right of the plugin list to open the custom plugin adding popup:
|
|
69
|
+
|
|
70
|
+
<Image
|
|
71
|
+
alt="Add Local Plugin in LobeChat Role Settings S2"
|
|
72
|
+
height={483}
|
|
73
|
+
inStep
|
|
74
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259748-2ef6a244-39bb-483c-b359-f156ffcbe1a4.png"
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
Fill in the **Plugin Description File Url** with `http://localhost:3400/manifest-dev.json`, which is the manifest address of the plugin we started locally.
|
|
78
|
+
|
|
79
|
+
At this point, you should see that the identifier of the plugin has been automatically recognized as `chat-plugin-template`. Next, you need to fill in the remaining form fields (only the title is required), and then click the <kbd>Save</kbd> button to complete the custom plugin addition.
|
|
80
|
+
|
|
81
|
+
<Image
|
|
82
|
+
alt="Add Local Plugin in LobeChat Role Settings S3"
|
|
83
|
+
height={483}
|
|
84
|
+
inStep
|
|
85
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259964-59f4906d-ae2e-4ec0-8b43-db36871d0869.png"
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
After adding, you can see the newly added plugin in the plugin list. If you need to modify the plugin configuration, you can click the <kbd>Settings</kbd> button on the far right to make changes.
|
|
89
|
+
|
|
90
|
+
<Image
|
|
91
|
+
alt="Add Local Plugin in LobeChat Role Settings S4"
|
|
92
|
+
height={483}
|
|
93
|
+
inStep
|
|
94
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260093-a0363c74-0b5b-48dd-b103-2db6b4a8262e.png"
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
### Test Plugin Function in Session
|
|
98
|
+
|
|
99
|
+
Next, we need to test whether the plugin's function is working properly.
|
|
100
|
+
|
|
101
|
+
Click the <kbd>Back</kbd> button to return to the session area, and then send a message to the assistant: "What should I wear?" At this point, the assistant will try to ask you about your gender and current mood.
|
|
102
|
+
|
|
103
|
+
<Image
|
|
104
|
+
alt="Test Plugin Function in Session S1"
|
|
105
|
+
height={483}
|
|
106
|
+
inStep
|
|
107
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260291-f0aa0e7c-0ffb-486c-a834-08e73d49896f.png"
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
After answering, the assistant will initiate the plugin call, retrieve recommended clothing data from the server based on your gender and mood, and push it to you. Finally, it will provide a text summary based on this information.
|
|
111
|
+
|
|
112
|
+
<Image
|
|
113
|
+
alt="Test Plugin Function in Session S2"
|
|
114
|
+
height={483}
|
|
115
|
+
inStep
|
|
116
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260461-c22ae797-2809-464b-96fc-d0c020f4807b.png"
|
|
117
|
+
/>
|
|
118
|
+
|
|
119
|
+
After completing these operations, you have understood the basic process of adding custom plugins and using them in LobeChat.
|
|
120
|
+
|
|
121
|
+
</Steps>
|
|
122
|
+
|
|
123
|
+
## Local Plugin Development
|
|
124
|
+
|
|
125
|
+
In the above process, we have learned how to add and use plugins. Next, we will focus on the process of developing custom plugins.
|
|
126
|
+
|
|
127
|
+
### Manifest
|
|
128
|
+
|
|
129
|
+
The `manifest` aggregates information on how the plugin's functionality is implemented. The core fields are `api` and `ui`, which respectively describe the server-side interface capabilities and the front-end rendering interface address of the plugin.
|
|
130
|
+
|
|
131
|
+
Taking the `manifest` in the template we provided as an example:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"api": [
|
|
136
|
+
{
|
|
137
|
+
"url": "http://localhost:3400/api/clothes",
|
|
138
|
+
"name": "recommendClothes",
|
|
139
|
+
"description": "Recommend clothes to the user based on their mood",
|
|
140
|
+
"parameters": {
|
|
141
|
+
"properties": {
|
|
142
|
+
"mood": {
|
|
143
|
+
"description": "The user's current mood, with optional values: happy, sad, anger, fear, surprise, disgust",
|
|
144
|
+
"enums": ["happy", "sad", "anger", "fear", "surprise", "disgust"],
|
|
145
|
+
"type": "string"
|
|
146
|
+
},
|
|
147
|
+
"gender": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"enum": ["man", "woman"],
|
|
150
|
+
"description": "The user's gender, which needs to be asked for from the user to obtain this information"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"required": ["mood", "gender"],
|
|
154
|
+
"type": "object"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"gateway": "http://localhost:3400/api/gateway",
|
|
159
|
+
"identifier": "chat-plugin-template",
|
|
160
|
+
"ui": {
|
|
161
|
+
"url": "http://localhost:3400",
|
|
162
|
+
"height": 200
|
|
163
|
+
},
|
|
164
|
+
"version": "1"
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
In this manifest, it mainly includes the following parts:
|
|
169
|
+
|
|
170
|
+
1. `identifier`: This is the unique identifier of the plugin, used to distinguish different plugins. This field needs to be globally unique.
|
|
171
|
+
2. `api`: This is an array containing all the API interface information of the plugin. Each interface includes the url, name, description, and parameters fields, all of which are required. The `description` and `parameters` fields will be sent to GPT as the `functions` parameter of the [Function Call](https://sspai.com/post/81986), and the parameters need to comply with the [JSON Schema](https://json-schema.org/) specification. In this example, the API interface is named `recommendClothes`, and its function is to recommend clothes based on the user's mood and gender. The interface parameters include the user's mood and gender, both of which are required.
|
|
172
|
+
3. `ui`: This field contains information about the plugin's user interface, indicating from which address LobeChat loads the plugin's front-end interface. Since LobeChat plugin interface loading is implemented based on iframes, the height and width of the plugin interface can be specified as needed.
|
|
173
|
+
4. `gateway`: This field specifies the gateway for LobeChat to query the plugin's API interface. LobeChat's default plugin gateway is a cloud-based service, and requests for custom plugins need to be sent to a locally launched service. Remote calls to a local address are generally not feasible. The `gateway` field solves this problem. By specifying the gateway in the manifest, LobeChat will send plugin requests to this address, and the local gateway address will dispatch requests to the local plugin service. Published online plugins do not need to specify this field.
|
|
174
|
+
5. `version`: This is the version number of the plugin, which currently has no effect.
|
|
175
|
+
|
|
176
|
+
In actual development, you can modify the plugin's description list according to your own needs to declare the functionality you want to implement. For a complete introduction to each field in the manifest, see: [manifest][manifest-docs-url].
|
|
177
|
+
|
|
178
|
+
### Project Structure
|
|
179
|
+
|
|
180
|
+
The [lobe-chat-plugin-template][lobe-chat-plugin-template-url] template project uses Next.js as the development framework, and its core directory structure is as follows:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
➜ chat-plugin-template
|
|
184
|
+
├── public
|
|
185
|
+
│ └── manifest-dev.json # Manifest file
|
|
186
|
+
├── src
|
|
187
|
+
│ └── pages
|
|
188
|
+
│ │ ├── api # Next.js server-side folder
|
|
189
|
+
│ │ │ ├── clothes.ts # Implementation of the recommendClothes interface
|
|
190
|
+
│ │ │ └── gateway.ts # Local plugin proxy gateway
|
|
191
|
+
│ │ └── index.tsx # Front-end display interface
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
This template uses Next.js as the development framework. You can use any development framework and language you are familiar with, as long as it can implement the functionality described in the manifest.
|
|
195
|
+
|
|
196
|
+
Contributions of more plugin templates using different frameworks and languages are also welcome.
|
|
197
|
+
|
|
198
|
+
### Server-Side
|
|
199
|
+
|
|
200
|
+
The server-side needs to implement the API interfaces described in the manifest. In the template, we use Vercel's [Edge Runtime](https://nextjs.org/docs/pages/api-reference/edge) to eliminate the need for maintenance.
|
|
201
|
+
|
|
202
|
+
#### API Implementation
|
|
203
|
+
|
|
204
|
+
For the Edge Runtime, we provide the `createErrorResponse` method in `@lobehub/chat-plugin-sdk` to quickly return error responses. Currently, the provided error types are detailed in: [PluginErrorType][plugin-error-type-url].
|
|
205
|
+
|
|
206
|
+
The implementation of the clothes interface in the template is as follows:
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
export default async (req: Request) => {
|
|
210
|
+
if (req.method !== 'POST') return createErrorResponse(PluginErrorType.MethodNotAllowed);
|
|
211
|
+
|
|
212
|
+
const { gender, mood } = (await req.json()) as RequestData;
|
|
213
|
+
|
|
214
|
+
const clothes = gender === 'man' ? manClothes : womanClothes;
|
|
215
|
+
|
|
216
|
+
const result: ResponseData = {
|
|
217
|
+
clothes: clothes[mood] || [],
|
|
218
|
+
mood,
|
|
219
|
+
today: Date.now(),
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
return new Response(JSON.stringify(result));
|
|
223
|
+
};
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Where `manClothes` and `womanClothes` are mock data and can be replaced with database queries in actual scenarios.
|
|
227
|
+
|
|
228
|
+
#### Plugin Gateway
|
|
229
|
+
|
|
230
|
+
Since the default plugin gateway for LobeChat is a cloud service `/api/plugins`, the cloud service sends requests to the address specified in the manifest's `api.url` to solve cross-origin issues.
|
|
231
|
+
|
|
232
|
+
For custom plugins, plugin requests need to be sent to the local service. Therefore, by specifying the gateway in the manifest ([http://localhost:3400/api/gateway](http://localhost:3400/api/gateway)), LobeChat> will directly request this address, and then only the corresponding gateway needs to be created at that address.
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
import { createLobeChatPluginGateway } from '@lobehub/chat-plugins-gateway';
|
|
236
|
+
|
|
237
|
+
export const config = {
|
|
238
|
+
runtime: 'edge',
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export default createLobeChatPluginGateway();
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
[`@lobehub/chat-plugins-gateway`](https://github.com/lobehub/chat-plugins-gateway) contains the implementation of the plugin gateway in LobeChat [here](https://github.com/lobehub/lobe-chat/blob/main/src/pages/api/plugins.api.ts). You can use this package directly to create a gateway, allowing LobeChat to access the local plugin service.
|
|
245
|
+
|
|
246
|
+
### Plugin UI Interface
|
|
247
|
+
|
|
248
|
+
The custom UI interface for plugins is optional. For example, the official plugin [Web Content Extraction](https://github.com/lobehub/chat-plugin-web-crawler) does not have a corresponding user interface.
|
|
249
|
+
|
|
250
|
+
<Image
|
|
251
|
+
alt="Plugin UI Interface S1"
|
|
252
|
+
height={483}
|
|
253
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263241-0e765fdc-3463-4c36-a398-aef177a30df9.png"
|
|
254
|
+
/>
|
|
255
|
+
|
|
256
|
+
If you want to display richer information in plugin messages or include some interactive operations, you can customize a user interface for the plugin. For example, the following image shows the user interface for the [Search Engine](https://github.com/lobehub/chat-plugin-search-engine) plugin.
|
|
257
|
+
|
|
258
|
+
<Image
|
|
259
|
+
alt="Plugin UI Interface S2"
|
|
260
|
+
height={483}
|
|
261
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263427-9bdc03d5-aa61-4f62-a2ce-88683f3308d8.png"
|
|
262
|
+
/>
|
|
263
|
+
|
|
264
|
+
#### Implementation of Plugin UI Interface
|
|
265
|
+
|
|
266
|
+
LobeChat implements the loading of plugin UI through `iframe` and uses `postMessage` to communicate with the plugin. Therefore, the implementation of the plugin UI is consistent with regular web development. You can use any frontend framework and development language you are familiar with.
|
|
267
|
+
|
|
268
|
+
<Image
|
|
269
|
+
alt="Implementation of Plugin UI Interface"
|
|
270
|
+
height={483}
|
|
271
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263653-4ea87abc-249a-49f3-a241-7ed93ddb1ddf.png"
|
|
272
|
+
/>
|
|
273
|
+
|
|
274
|
+
In the template we provide, we use React + Next.js + [antd](https://ant.design/) as the frontend interface framework. You can find the implementation of the user interface in [`src/pages/index.tsx`](https://github.com/lobehub/chat-plugin-template/blob/main/src/pages/index.tsx).
|
|
275
|
+
|
|
276
|
+
As for plugin communication, we provide relevant methods in [`@lobehub/chat-plugin-sdk`](https://github.com/lobehub/chat-plugin-sdk) to simplify communication between the plugin and LobeChat. You can actively retrieve the current message data from LobeChat using the `fetchPluginMessage` method. For detailed information about this method, see: [fetchPluginMessage][fetch-plugin-message-url].
|
|
277
|
+
|
|
278
|
+
```tsx
|
|
279
|
+
import { fetchPluginMessage } from '@lobehub/chat-plugin-sdk';
|
|
280
|
+
import { memo, useEffect, useState } from 'react';
|
|
281
|
+
|
|
282
|
+
import { ResponseData } from '@/type';
|
|
283
|
+
|
|
284
|
+
const Render = memo(() => {
|
|
285
|
+
const [data, setData] = useState<ResponseData>();
|
|
286
|
+
|
|
287
|
+
useEffect(() => {
|
|
288
|
+
// Retrieve the current plugin message from LobeChat
|
|
289
|
+
fetchPluginMessage().then((e: ResponseData) => {
|
|
290
|
+
setData(e);
|
|
291
|
+
});
|
|
292
|
+
}, []);
|
|
293
|
+
|
|
294
|
+
return <>...</>;
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
export default Render;
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Plugin Deployment and Release
|
|
301
|
+
|
|
302
|
+
Once you have finished developing the plugin, you can deploy it using your preferred method, such as using Vercel or packaging it as a Docker container for release, and so on.
|
|
303
|
+
|
|
304
|
+
If you want more people to use your plugin, feel free to [submit it for listing](https://github.com/lobehub/lobe-chat-plugins) on the plugin marketplace.
|
|
305
|
+
|
|
306
|
+
[![][submit-plugin-shield]][submit-plugin-url]
|
|
307
|
+
|
|
308
|
+
### Plugin Shield
|
|
309
|
+
|
|
310
|
+
[](https://github.com/lobehub/lobe-chat-plugins)
|
|
311
|
+
|
|
312
|
+
```md
|
|
313
|
+
[](https://github.com/lobehub/lobe-chat-plugins)
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Links
|
|
317
|
+
|
|
318
|
+
- **📘 Pluging SDK Documentation**: [https://chat-plugin-sdk.lobehub.com](https://chat-plugin-sdk.lobehub.com)
|
|
319
|
+
- **🚀 chat-plugin-template**: [https://github.com/lobehub/chat-plugin-template](https://github.com/lobehub/chat-plugin-template)
|
|
320
|
+
- **🧩 chat-plugin-sdk**: [https://github.com/lobehub/chat-plugin-sdk](https://github.com/lobehub/chat-plugin-sdk)
|
|
321
|
+
- **🚪 chat-plugin-gateway**: [https://github.com/lobehub/chat-plugins-gateway](https://github.com/lobehub/chat-plugins-gateway)
|
|
322
|
+
- **🏪 lobe-chat-plugins**: [https://github.com/lobehub/lobe-chat-plugins](https://github.com/lobehub/lobe-chat-plugins)
|
|
323
|
+
|
|
324
|
+
[fetch-plugin-message-url]: https://github.com/lobehub/chat-plugin-template
|
|
325
|
+
[lobe-chat-plugin-template-url]: https://github.com/lobehub/chat-plugin-template
|
|
326
|
+
[manifest-docs-url]: https://chat-plugin-sdk.lobehub.com/guides/plugin-manifest
|
|
327
|
+
[plugin-error-type-url]: https://github.com/lobehub/chat-plugin-template
|
|
328
|
+
[submit-plugin-shield]: https://img.shields.io/badge/🧩/🏪_submit_plugin-%E2%86%92-95f3d9?labelColor=black&style=for-the-badge
|
|
329
|
+
[submit-plugin-url]: https://github.com/lobehub/lobe-chat-plugins
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: LobeChat 插件开发指南
|
|
3
|
+
description: 学习如何在 LobeChat 中添加和使用自定义插件,包括创建插件项目、在角色设置中添加本地插件、测试插件功能以及插件开发流程和部署。
|
|
4
|
+
tags:
|
|
5
|
+
- LobeChat
|
|
6
|
+
- 插件开发
|
|
7
|
+
- 自定义插件
|
|
8
|
+
- 插件部署
|
|
9
|
+
- 插件发布
|
|
10
|
+
- 插件UI
|
|
11
|
+
- 插件SDK
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# 插件开发指南
|
|
15
|
+
|
|
16
|
+
## 插件构成
|
|
17
|
+
|
|
18
|
+
一个 LobeChat 的插件由以下几个部分组成:
|
|
19
|
+
|
|
20
|
+
1. **插件索引**:用于展示插件的基本信息,包括插件名称、描述、作者、版本、插件描述清单的链接,官方的插件索引地址:[lobe-chat-plugins](https://github.com/lobehub/lobe-chat-plugins)。若想上架插件到官方插件市场,需要 [提交 PR](https://github.com/lobehub/lobe-chat-plugins/pulls) 到该仓库;
|
|
21
|
+
2. **插件描述清单 (manifest)**:用于描述插件的功能实现,包含了插件的服务端描述、前端展示信息、版本号等。关于 manifest 的详细介绍,详见 [manifest][manifest-docs-url];
|
|
22
|
+
3. **插件服务**:用于实现插件描述清单中所描述的服务端和前端模块,分别如下:
|
|
23
|
+
- **服务端**:需要实现 manifest 中描述的 `api` 部分的接口能力;
|
|
24
|
+
- **前端 UI**(可选):需要实现 manifest 中描述的 `ui` 部分的界面,该界面将会在插件消息中透出,进而实现比文本更加丰富的信息展示方式。
|
|
25
|
+
|
|
26
|
+
## 自定义插件流程
|
|
27
|
+
|
|
28
|
+
本节将会介绍如何在 LobeChat 中添加和使用一个自定义插件。
|
|
29
|
+
|
|
30
|
+
<Steps>
|
|
31
|
+
### 创建并启动插件项目
|
|
32
|
+
|
|
33
|
+
你需要先在本地创建一个插件项目,可以使用我们准备好的模板 [lobe-chat-plugin-template][lobe-chat-plugin-template-url]
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
$ git clone https://github.com/lobehub/chat-plugin-template.git
|
|
37
|
+
$ cd chat-plugin-template
|
|
38
|
+
$ npm i
|
|
39
|
+
$ npm run dev
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
当出现`ready started server on 0.0.0.0:3400, url: http://localhost:3400` 时,说明插件服务已经在本地启动成功。
|
|
43
|
+
|
|
44
|
+
<Image
|
|
45
|
+
alt="创建并启动插件项目"
|
|
46
|
+
height={483}
|
|
47
|
+
inStep
|
|
48
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259526-9ef25272-4312-429b-93bc-a95515727ed3.png"
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
### 在 LobeChat 角色设置中添加本地插件
|
|
52
|
+
|
|
53
|
+
接下来进入到 LobeChat 中,创建一个新的助手,并进入它的会话设置页:
|
|
54
|
+
|
|
55
|
+
<Image
|
|
56
|
+
alt="在 LobeChat 角色设置中添加本地插件 S1"
|
|
57
|
+
height={483}
|
|
58
|
+
inStep
|
|
59
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259643-1a9cc34a-76f3-4ccf-928b-129654670efd.png"
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
点击插件列表右侧的 <kbd>添加</kbd> 按钮,打开自定义插件添加弹窗:
|
|
63
|
+
|
|
64
|
+
<Image
|
|
65
|
+
alt="在 LobeChat 角色设置中添加本地插件 S2"
|
|
66
|
+
height={483}
|
|
67
|
+
inStep
|
|
68
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259748-2ef6a244-39bb-483c-b359-f156ffcbe1a4.png"
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
在 **插件描述文件 Url** 地址 中填入 `http://localhost:3400/manifest-dev.json` ,这是我们本地启动的插件描述清单地址。
|
|
72
|
+
|
|
73
|
+
此时,你应该可以看到看到插件的标识符一栏已经被自动识别为 `chat-plugin-template`。接下来你需要填写剩下的表单字段(只有标题必填),然后点击 <kbd>保存</kbd> 按钮,即可完成自定义插件添加。
|
|
74
|
+
|
|
75
|
+
<Image
|
|
76
|
+
alt="在 LobeChat 角色设置中添加本地插件 S3"
|
|
77
|
+
height={483}
|
|
78
|
+
inStep
|
|
79
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259964-59f4906d-ae2e-4ec0-8b43-db36871d0869.png"
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
完成添加后,在插件列表中就能看到刚刚添加的插件,如果需要修改插件的配置,可以点击最右侧的 <kbd>设置</kbd> 按钮进行修改。
|
|
83
|
+
|
|
84
|
+
<Image
|
|
85
|
+
alt="在 LobeChat 角色设置中添加本地插件 S4"
|
|
86
|
+
height={483}
|
|
87
|
+
inStep
|
|
88
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260093-a0363c74-0b5b-48dd-b103-2db6b4a8262e.png"
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
### 会话测试插件功能
|
|
92
|
+
|
|
93
|
+
接来下我们需要测试这个插件的功能是否正常。
|
|
94
|
+
|
|
95
|
+
点击 <kbd>返回</kbd> 按钮回到会话区,然后向助手发送消息:「我应该穿什么? 」此时助手将会尝试向你询问,了解你的性别与当前的心情。
|
|
96
|
+
|
|
97
|
+
<Image
|
|
98
|
+
alt="会话测试插件功能 S1"
|
|
99
|
+
height={483}
|
|
100
|
+
inStep
|
|
101
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260291-f0aa0e7c-0ffb-486c-a834-08e73d49896f.png"
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
当回答完毕后,助手将会发起插件的调用,根据你的性别、心情,从服务端获取推荐的衣服数据,并推送给你。最后基于这些信息做一轮文本总结。
|
|
105
|
+
|
|
106
|
+
<Image
|
|
107
|
+
alt="会话测试插件功能 S2"
|
|
108
|
+
height={483}
|
|
109
|
+
inStep
|
|
110
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260461-c22ae797-2809-464b-96fc-d0c020f4807b.png"
|
|
111
|
+
/>
|
|
112
|
+
|
|
113
|
+
当完成这些操作后,你已经了解了添加自定义插件,并在 LobeChat 中使用的基础流程。
|
|
114
|
+
|
|
115
|
+
</Steps>
|
|
116
|
+
|
|
117
|
+
## 本地插件开发
|
|
118
|
+
|
|
119
|
+
在上述流程中,我们已经了解插件的添加和使用的方式,接下来重点介绍自定义插件开发的过程。
|
|
120
|
+
|
|
121
|
+
### manifest
|
|
122
|
+
|
|
123
|
+
`manifest` 聚合了插件功能如何实现的信息。核心字段为 `api` 与 `ui`,分别描述了插件的服务端接口能力与前端渲染的界面地址。
|
|
124
|
+
|
|
125
|
+
以我们提供的模板中的 `manifest` 为例:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"api": [
|
|
130
|
+
{
|
|
131
|
+
"url": "http://localhost:3400/api/clothes",
|
|
132
|
+
"name": "recommendClothes",
|
|
133
|
+
"description": "根据用户的心情,给用户推荐他有的衣服",
|
|
134
|
+
"parameters": {
|
|
135
|
+
"properties": {
|
|
136
|
+
"mood": {
|
|
137
|
+
"description": "用户当前的心情,可选值有:开心(happy), 难过(sad),生气 (anger),害怕(fear),惊喜( surprise),厌恶 (disgust)",
|
|
138
|
+
"enums": ["happy", "sad", "anger", "fear", "surprise", "disgust"],
|
|
139
|
+
"type": "string"
|
|
140
|
+
},
|
|
141
|
+
"gender": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"enum": ["man", "woman"],
|
|
144
|
+
"description": "对话用户的性别,需要询问用户后才知道这个信息"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"required": ["mood", "gender"],
|
|
148
|
+
"type": "object"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"gateway": "http://localhost:3400/api/gateway",
|
|
153
|
+
"identifier": "chat-plugin-template",
|
|
154
|
+
"ui": {
|
|
155
|
+
"url": "http://localhost:3400",
|
|
156
|
+
"height": 200
|
|
157
|
+
},
|
|
158
|
+
"version": "1"
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
在这份 manifest 中,主要包含了以下几个部分:
|
|
163
|
+
|
|
164
|
+
1. `identifier`:这是插件的唯一标识符,用来区分不同的插件,这个字段需要全局唯一。
|
|
165
|
+
2. `api`:这是一个数组,包含了插件的所有 API 接口信息。每个接口都包含了 url、name、description 和 parameters 字段,均为必填项。其中 `description` 和 `parameters` 两个字段,将会作为 [Function Call](https://sspai.com/post/81986) 的 `functions` 参数发送给 gpt, parameters 需要符合 [JSON Schema](https://json-schema.org/) 规范。 在这个例子中,api 接口名为 `recommendClothes` ,这个接口的功能是根据用户的心情和性别来推荐衣服。接口的参数包括用户的心情和性别,这两个参数都是必填项。
|
|
166
|
+
3. `ui`:这个字段包含了插件的用户界面信息,指明了 LobeChat 从哪个地址加载插件的前端界面。由于 LobeChat 插件界面加载是基于 iframe 实现的,因此可以按需指定插件界面的高度、宽度。
|
|
167
|
+
4. `gateway`:这个字段指定了 LobeChat 查询 api 接口的网关。LobeChat 默认的插件网关是云端服务,而自定义插件的请求需要发给本地启动的服务,远端调用本地地址,一般调用不通。gateway 字段解决了该问题。通过在 manifest 中指定 gateway,LobeChat 将会向该地址发送插件请求,本地的网关地址将会调度请求到本地的插件服务。发布到线上的插件可以不用指定该字段。
|
|
168
|
+
5. `version`:这是插件的版本号,现阶段暂时没有作用;
|
|
169
|
+
|
|
170
|
+
在实际开发中,你可以根据自己的需求,修改插件的描述清单,声明想要实现的功能。 关于 manifest 各个字段的完整介绍,参见:[manifest][manifest-docs-url]。
|
|
171
|
+
|
|
172
|
+
### 项目结构
|
|
173
|
+
|
|
174
|
+
[lobe-chat-plugin-template][lobe-chat-plugin-template-url] 这个模板项目使用了 Next.js 作为开发框架,它的核心目录结构如下:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
➜ chat-plugin-template
|
|
178
|
+
├── public
|
|
179
|
+
│ └── manifest-dev.json # 描述清单文件
|
|
180
|
+
├── src
|
|
181
|
+
│ └── pages
|
|
182
|
+
│ │ ├── api # nextjs 服务端文件夹
|
|
183
|
+
│ │ │ ├── clothes.ts # recommendClothes 接口实现
|
|
184
|
+
│ │ │ └── gateway.ts # 本地插件代理网关
|
|
185
|
+
│ │ └── index.tsx # 前端展示界面
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
本模板使用 Next.js 作为开发框架。你可以使用任何你熟悉的开发框架与开发语言,只要能够实现 manifest 中描述的功能即可。
|
|
189
|
+
|
|
190
|
+
同时也欢迎大家贡献更多框架与语言的插件模板。
|
|
191
|
+
|
|
192
|
+
### 服务端
|
|
193
|
+
|
|
194
|
+
服务端需要实现 manifest 中描述的 api 接口。在模板中,我们使用了 vercel 的 [Edge Runtime](https://nextjs.org/docs/pages/api-reference/edge),免去运维。
|
|
195
|
+
|
|
196
|
+
#### API 实现
|
|
197
|
+
|
|
198
|
+
针对 Edge Runtime ,我们在 `@lobehub/chat-plugin-sdk` 提供了 `createErrorResponse` 方法,用于快速返回错误响应。目前提供的错误类型详见:[PluginErrorType][plugin-error-type-url]。
|
|
199
|
+
|
|
200
|
+
模板中的 clothes 接口实现如下:
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
export default async (req: Request) => {
|
|
204
|
+
if (req.method !== 'POST') return createErrorResponse(PluginErrorType.MethodNotAllowed);
|
|
205
|
+
|
|
206
|
+
const { gender, mood } = (await req.json()) as RequestData;
|
|
207
|
+
|
|
208
|
+
const clothes = gender === 'man' ? manClothes : womanClothes;
|
|
209
|
+
|
|
210
|
+
const result: ResponseData = {
|
|
211
|
+
clothes: clothes[mood] || [],
|
|
212
|
+
mood,
|
|
213
|
+
today: Date.now(),
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
return new Response(JSON.stringify(result));
|
|
217
|
+
};
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
其中 `maniClothes` 和 `womanClothes` 是 mock 数据,在实际场景中,可以替换为数据库查询等。
|
|
221
|
+
|
|
222
|
+
#### Plugin Gateway
|
|
223
|
+
|
|
224
|
+
由于 LobeChat 默认的插件网关是云端服务 `/api/plugins`,云端服务通过 manifest 上的 `api.url` 地址发送请求,以解决跨域问题。
|
|
225
|
+
|
|
226
|
+
针对自定义插件,插件请求需要发送给本地服务, 因此通过在 manifest 中指定网关 ([http://localhost:3400/api/gateway),LobeChat](<http://localhost:3400/api/gateway),LobeChat>) 将会直接请求该地址,然后只需要在该地址下创建对应的网关即可。
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
import { createLobeChatPluginGateway } from '@lobehub/chat-plugins-gateway';
|
|
230
|
+
|
|
231
|
+
export const config = {
|
|
232
|
+
runtime: 'edge',
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export default createLobeChatPluginGateway();
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
[`@lobehub/chat-plugins-gateway`](https://github.com/lobehub/chat-plugins-gateway) 包含了 LobeChat 中插件网关的[实现](https://github.com/lobehub/lobe-chat/blob/main/src/pages/api/plugins.api.ts),你可以直接使用该包创建网关,进而让 LobeChat 访问到本地的插件服务。
|
|
239
|
+
|
|
240
|
+
### 插件 UI 界面
|
|
241
|
+
|
|
242
|
+
自定义插件的 UI 界面是一个可选项。例如 官方插件 [「🧩 / 🕸 网页内容提取」](https://github.com/lobehub/chat-plugin-web-crawler),没有实现相应的用户界面。
|
|
243
|
+
|
|
244
|
+
<Image
|
|
245
|
+
alt="插件 UI 界面 S1"
|
|
246
|
+
height={483}
|
|
247
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263241-0e765fdc-3463-4c36-a398-aef177a30df9.png"
|
|
248
|
+
/>
|
|
249
|
+
|
|
250
|
+
如果你希望在插件消息中展示更加丰富的信息,或者包含一些富交互操作,你可以为插件定制一个用户界面。例如下图则为[「搜索引擎」](https://github.com/lobehub/chat-plugin-search-engine)插件的用户界面。
|
|
251
|
+
|
|
252
|
+
<Image
|
|
253
|
+
alt="插件 UI 界面 S2"
|
|
254
|
+
height={483}
|
|
255
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263427-9bdc03d5-aa61-4f62-a2ce-88683f3308d8.png"
|
|
256
|
+
/>
|
|
257
|
+
|
|
258
|
+
#### 插件 UI 界面实现
|
|
259
|
+
|
|
260
|
+
LobeChat 通过 `iframe` 实现插件 ui 的加载,使用 `postMessage` 实现主体与插件的通信。因此, 插件 UI 的实现方式与普通的网页开发一致,你可以使用任何你熟悉的前端框架与开发语言。
|
|
261
|
+
|
|
262
|
+
<Image
|
|
263
|
+
alt="插件 UI 界面实现"
|
|
264
|
+
height={483}
|
|
265
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263653-4ea87abc-249a-49f3-a241-7ed93ddb1ddf.png"
|
|
266
|
+
/>
|
|
267
|
+
|
|
268
|
+
在我们提供的模板中使用了 React + Next.js + [antd](https://ant.design/) 作为前端界面框架,你可以在 [`src/pages/index.tsx`](https://github.com/lobehub/chat-plugin-template/blob/main/src/pages/index.tsx) 中找到用户界面的实现。
|
|
269
|
+
|
|
270
|
+
其中关于插件通信,我们在 [`@lobehub/chat-plugin-sdk`](https://github.com/lobehub/chat-plugin-sdk) 提供了相关方法,用于简化插件与 LobeChat 的通信。你可以通过 `fetchPluginMessage` 方法主动向 LobeChat 获取当前消息的数据。关于该方法的详细介绍,参见:[fetchPluginMessage][fetch-plugin-message-url]。
|
|
271
|
+
|
|
272
|
+
```tsx
|
|
273
|
+
import { fetchPluginMessage } from '@lobehub/chat-plugin-sdk';
|
|
274
|
+
import { memo, useEffect, useState } from 'react';
|
|
275
|
+
|
|
276
|
+
import { ResponseData } from '@/type';
|
|
277
|
+
|
|
278
|
+
const Render = memo(() => {
|
|
279
|
+
const [data, setData] = useState<ResponseData>();
|
|
280
|
+
|
|
281
|
+
useEffect(() => {
|
|
282
|
+
// 从 LobeChat 获取当前插件的消息
|
|
283
|
+
fetchPluginMessage().then((e: ResponseData) => {
|
|
284
|
+
setData(e);
|
|
285
|
+
});
|
|
286
|
+
}, []);
|
|
287
|
+
|
|
288
|
+
return <>...</>;
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
export default Render;
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## 插件部署与发布
|
|
295
|
+
|
|
296
|
+
当你完成插件的开发后,你可以使用你习惯的方式进行插件的部署。例如使用 vercel ,或者打包成 docker 发布等等。
|
|
297
|
+
|
|
298
|
+
如果你希望插件被更多人使用,欢迎将你的插件 [提交上架](https://github.com/lobehub/lobe-chat-plugins) 到插件市场。
|
|
299
|
+
|
|
300
|
+
[![][submit-plugin-shield]][submit-plugin-url]
|
|
301
|
+
|
|
302
|
+
### 插件 Shield
|
|
303
|
+
|
|
304
|
+
[](https://github.com/lobehub/lobe-chat-plugins)
|
|
305
|
+
|
|
306
|
+
```markdown
|
|
307
|
+
[](https://github.com/lobehub/lobe-chat-plugins)
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## 链接
|
|
311
|
+
|
|
312
|
+
- **📘 Pluging SDK 文档**: [https://chat-plugin-sdk.lobehub.com](https://chat-plugin-sdk.lobehub.com)
|
|
313
|
+
- **🚀 chat-plugin-template**: [https://github.com/lobehub/chat-plugin-template](https://github.com/lobehub/chat-plugin-template)
|
|
314
|
+
- **🧩 chat-plugin-sdk**: [https://github.com/lobehub/chat-plugin-sdk](https://github.com/lobehub/chat-plugin-sdk)
|
|
315
|
+
- **🚪 chat-plugin-gateway**: [https://github.com/lobehub/chat-plugins-gateway](https://github.com/lobehub/chat-plugins-gateway)
|
|
316
|
+
- **🏪 lobe-chat-plugins**: [https://github.com/lobehub/lobe-chat-plugins](https://github.com/lobehub/lobe-chat-plugins)
|
|
317
|
+
|
|
318
|
+
[fetch-plugin-message-url]: https://github.com/lobehub/chat-plugin-template
|
|
319
|
+
[lobe-chat-plugin-template-url]: https://github.com/lobehub/chat-plugin-template
|
|
320
|
+
[manifest-docs-url]: https://chat-plugin-sdk.lobehub.com/guides/plugin-manifest
|
|
321
|
+
[plugin-error-type-url]: https://github.com/lobehub/chat-plugin-template
|
|
322
|
+
[submit-plugin-shield]: https://img.shields.io/badge/🧩/🏪_submit_plugin-%E2%86%92-95f3d9?labelColor=black&style=for-the-badge
|
|
323
|
+
[submit-plugin-url]: https://github.com/lobehub/lobe-chat-plugins
|