🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style(agent-share): refine share settings copy and add unit strings (#20146)
YuTengjing3506edca60bb
diff --git a/apps/server/src/routers/lambda/__tests__/share.test.ts b/apps/server/src/routers/lambda/__tests__/share.test.tsindex 876f39edca6..8cf784bd80d 100644--- a/apps/server/src/routers/lambda/__tests__/share.test.ts+++ b/apps/server/src/routers/lambda/__tests__/share.test.ts@@ -231,6 +231,7 @@ describe('shareRouter', () => {userViewCount: 42,visibility: 'link',workspaceId: null,+ workspaceSlug: null,};beforeEach(() => {@@ -329,6 +330,7 @@ describe('shareRouter', () => {demoCases: [],featuredWorks: [],isOwner: false,+ ownerWorkspaceSlug: null,shareId: 'agent-share-1',slug: 'shared-agent',stats: { ...emptyDeliveryStats, conversations: 12, views: 42, visitors: 7 },@@ -474,6 +476,28 @@ describe('shareRouter', () => {});});+ it('returns the Workspace slug to the owner only', async () => {+ vi.mocked(AgentShareModel.findBySlugOrId).mockResolvedValue({+ ...agentShare,+ workspaceId: 'workspace-1',+ workspaceSlug: 'acme',+ } as any);++ const ownerCaller = shareRouter.createCaller(+ await createContextInner({ userId: 'owner-user' }),+ );+ const visitorCaller = shareRouter.createCaller(+ await createContextInner({ userId: 'visitor-user' }),+ );++ await expect(ownerCaller.getSharedAgent({ slugOrId: 'shared-agent' })).resolves.toMatchObject(+ { ownerWorkspaceSlug: 'acme' },+ );+ await expect(+ visitorCaller.getSharedAgent({ slugOrId: 'shared-agent' }),+ ).resolves.toMatchObject({ ownerWorkspaceSlug: null });+ });+it('does not count owner views', async () => {const caller = shareRouter.createCaller(await createContextInner({ userId: 'owner-user' }));diff --git a/apps/server/src/routers/lambda/share.ts b/apps/server/src/routers/lambda/share.tsindex 8509a3f218f..00818df2d8c 100644--- a/apps/server/src/routers/lambda/share.ts+++ b/apps/server/src/routers/lambda/share.ts@@ -240,6 +240,7 @@ export const shareRouter = router({demoCases: share.shareConfig.demoCases ?? [],featuredWorks,isOwner,+ ownerWorkspaceSlug: isOwner ? (share.workspaceSlug ?? null) : null,shareId: share.shareId,slug: share.shareConfig.slug ?? null,stats: { ...stats, ...deliveryStats, views: share.userViewCount },diff --git a/locales/en-US/agent.json b/locales/en-US/agent.jsonindex 3a09f2dd268..111bf888f8d 100644--- a/locales/en-US/agent.json+++ b/locales/en-US/agent.json@@ -315,15 +315,18 @@"channel.wechatUserIdHint": "WeChat account identifier returned by the authorization flow.","share.entry": "Share this Agent","share.settings.limits.desc": "Every visitor run is billed to your account, so these caps are what keep a shared link from running up your bill. They always apply — you can change the numbers, but not turn them off.",- "share.settings.limits.maxFileStorage": "File storage limit (MB)","share.settings.limits.maxFileStorageHint": "Files visitors attach are stored on your account. Uploads stop once they reach this total; set 0 to turn attachments off.",+ "share.settings.limits.maxFileStorageLabel": "File storage limit","share.settings.limits.maxFileStorageWorkspaceHint": "Files visitors attach are stored in the Workspace. Uploads stop once they reach this total; set 0 to turn attachments off.","share.settings.limits.maxTopicsPerVisitor": "Topics per visitor","share.settings.limits.maxTopicsPerVisitorHint": "How many separate topics each signed-in visitor can start.",+ "share.settings.limits.maxTopicsPerVisitorUnit": "topics","share.settings.limits.maxTurnsPerTopic": "Turns per topic","share.settings.limits.maxTurnsPerTopicHint": "How many messages a visitor can send inside one topic.",- "share.settings.limits.monthlySpendLimit": "Monthly spend cap (M credits)",+ "share.settings.limits.maxTurnsPerTopicUnit": "turns",+ "share.settings.limits.monthlySpendLimit": "Monthly spend cap","share.settings.limits.monthlySpendLimitHint": "Visitor runs stop once this month’s spend on this Agent reaches the cap. Resets on the 1st of each month (UTC).",+ "share.settings.limits.monthlySpendLimitUnit": "M credits","share.settings.limits.title": "Limits","share.settings.limits.workspaceDesc": "Every visitor run is billed to the Workspace budget, not to the visitor or any member quota. These per-Agent caps always apply — you can change the numbers, but not turn them off.","share.settings.link.changeModel": "Change model",@@ -393,6 +396,8 @@"share.settings.profile.saveError": "Could not save. Your draft is preserved. Try again.","share.settings.profile.saved": "Profile saved","share.settings.profile.title": "Public profile",+ "share.settings.profile.unsaved": "You have unsaved changes. Visitors will only see them after you save.",+ "share.settings.profile.upToDate": "Visitors see the saved content.","share.settings.skills.availableGroup": "Not granted · {{count}}","share.settings.skills.desc": "Only the skills you tick here can be loaded during a visitor run. A skill you grant runs on your account, with whatever its instructions say.","share.settings.skills.empty": "This Agent has no skills that can be granted to visitors.",@@ -406,8 +411,10 @@"share.settings.tabs.stats": "Stats","share.settings.title": "Share Agent","share.settings.tools.apiGrantedCount": "{{granted}} of {{total}} APIs granted",- "share.settings.tools.apiNotAvailableToVisitors": "This action can never be used in a shared run — it either needs your approval or is otherwise off-limits to visitors.",+ "share.settings.tools.apiNeedsApproval": "This action needs your approval before it runs, and nobody can approve it during a shared run, so it stays off.",+ "share.settings.tools.apiNotAvailableToVisitors": "This action is never available to visitors in a shared run.","share.settings.tools.apiWritesOwnerData": "Visitors can never write to your memory — this action stays off in shared runs.",+ "share.settings.tools.apiWritesOwnerDocuments": "Visitors can never delete or copy your documents or change their load rules — this action stays off in shared runs.","share.settings.tools.availableGroup": "Not granted · {{count}}","share.settings.tools.configureApis": "Choose which APIs visitors can call","share.settings.tools.desc": "Only the tools you tick here can be called during a visitor run. Tools that could reach your device or local files are never offered.",@@ -423,6 +430,9 @@"share.settings.usage.conversations": "Topics","share.settings.usage.conversationsHint": "Topics created by visitors through this share.","share.settings.usage.desc": "What this share has attracted, and what it has cost you.",+ "share.settings.usage.detail.desc": "Every model call made by visitors of this share, billed to your account.",+ "share.settings.usage.detail.title": "Details",+ "share.settings.usage.detail.workspaceDesc": "Every model call made by visitors of this share, billed to the workspace.","share.settings.usage.fileStorage": "File storage","share.settings.usage.fileStorageOfLimit": "{{used}} of {{limit}}","share.settings.usage.fileStorageOff": "{{used}} · attachments off",diff --git a/locales/zh-CN/agent.json b/locales/zh-CN/agent.jsonindex 79d18ce0926..e67caa31d7c 100644--- a/locales/zh-CN/agent.json+++ b/locales/zh-CN/agent.json@@ -315,15 +315,18 @@"channel.wechatUserIdHint": "通过授权流程返回的微信账号标识符。","share.entry": "分享此助手","share.settings.limits.desc": "访客的每次运行都记在你的账户上,这些上限是分享链接不会跑出高额账单的唯一保障。上限始终生效,你可以调整数值,但不能关闭。",- "share.settings.limits.maxFileStorage": "文件存储上限(MB)","share.settings.limits.maxFileStorageHint": "访客上传的文件会存放在你的账号里。累计达到这个总量后就不能再上传;填 0 表示关闭附件功能。",+ "share.settings.limits.maxFileStorageLabel": "文件存储上限","share.settings.limits.maxFileStorageWorkspaceHint": "访客上传的文件会存放在工作区内。累计达到这个总量后就不能再上传;填 0 表示关闭附件功能。","share.settings.limits.maxTopicsPerVisitor": "每位访客的话题数","share.settings.limits.maxTopicsPerVisitorHint": "每位已登录访客最多能创建多少个独立话题。",+ "share.settings.limits.maxTopicsPerVisitorUnit": "个","share.settings.limits.maxTurnsPerTopic": "每个话题的轮次","share.settings.limits.maxTurnsPerTopicHint": "访客在一个话题里最多能发送多少条消息。",- "share.settings.limits.monthlySpendLimit": "每月消耗上限(M 积分)",+ "share.settings.limits.maxTurnsPerTopicUnit": "轮",+ "share.settings.limits.monthlySpendLimit": "每月消耗上限","share.settings.limits.monthlySpendLimitHint": "本月该助手的消耗达到上限后,访客将无法继续运行。按自然月统计,每月 1 日(UTC)重置。",+ "share.settings.limits.monthlySpendLimitUnit": "M 积分","share.settings.limits.title": "使用限制","share.settings.limits.workspaceDesc": "访客的每次运行都会从工作区预算扣费,不会扣访客余额,也不占用创建者或其他成员的个人额度。每个智能体的这些上限始终生效,你可以调整数值,但不能关闭。","share.settings.link.changeModel": "更换模型",@@ -393,6 +396,8 @@"share.settings.profile.saveError": "保存失败,草稿已保留,请重试。","share.settings.profile.saved": "宣传页内容已保存","share.settings.profile.title": "宣传页内容",+ "share.settings.profile.unsaved": "有未保存的修改,保存后访客才能看到。",+ "share.settings.profile.upToDate": "访客看到的是已保存的内容。","share.settings.skills.availableGroup": "未开放 · {{count}}","share.settings.skills.desc": "只有在这里勾选的技能才能在访客运行中被加载。开放出去的技能会在你的账号下运行,并按它自身的指令行事。","share.settings.skills.empty": "这个助手没有可以开放给访客的技能。",@@ -406,8 +411,10 @@"share.settings.tabs.stats": "统计","share.settings.title": "分享助手","share.settings.tools.apiGrantedCount": "已开放 {{granted}}/{{total}} 个接口",- "share.settings.tools.apiNotAvailableToVisitors": "该操作无法在分享运行中使用:它要么需要你本人确认,要么本就不对访客开放。",+ "share.settings.tools.apiNeedsApproval": "该操作需要你本人确认后才能执行,分享运行中无人确认,因此始终关闭。",+ "share.settings.tools.apiNotAvailableToVisitors": "该操作在分享运行中始终不对访客开放。","share.settings.tools.apiWritesOwnerData": "访客不能写入你的记忆,该操作在分享运行中始终关闭。",+ "share.settings.tools.apiWritesOwnerDocuments": "访客不能删除、复制你的文档或修改其加载规则,该操作在分享运行中始终关闭。","share.settings.tools.availableGroup": "未开放 · {{count}}","share.settings.tools.configureApis": "选择访客可调用的接口","share.settings.tools.desc": "只有在这里勾选的工具才能在访客运行中被调用。可能触达你设备或本地文件的工具永远不会出现在列表中。",@@ -423,6 +430,9 @@"share.settings.usage.conversations": "话题数","share.settings.usage.conversationsHint": "访客通过此分享创建的话题数量。","share.settings.usage.desc": "这个分享带来了多少访问,又花了你多少钱。",+ "share.settings.usage.detail.desc": "访客通过此分享发起的每一次模型调用,费用记在你的账户上。",+ "share.settings.usage.detail.title": "明细",+ "share.settings.usage.detail.workspaceDesc": "访客通过此分享发起的每一次模型调用,费用记在工作区上。","share.settings.usage.fileStorage": "文件存储","share.settings.usage.fileStorageOfLimit": "{{used}} / {{limit}}","share.settings.usage.fileStorageOff": "{{used}} · 附件已关闭",diff --git a/packages/database/src/models/__tests__/agentShare.test.ts b/packages/database/src/models/__tests__/agentShare.test.tsindex 20371cad010..82a88fb102f 100644--- a/packages/database/src/models/__tests__/agentShare.test.ts+++ b/packages/database/src/models/__tests__/agentShare.test.ts@@ -203,6 +203,7 @@ describe('AgentShareModel', () => {ownerId: userId,shareId: share.id,workspaceId,+ workspaceSlug: 'agent-share-test-workspace',});await expect(AgentShareModel.readCurrentVisitorCaps(serverDB, workspaceAgentId),diff --git a/packages/database/src/models/agentShare.ts b/packages/database/src/models/agentShare.tsindex 25d6ccb10cb..530c941303f 100644--- a/packages/database/src/models/agentShare.ts+++ b/packages/database/src/models/agentShare.ts@@ -16,7 +16,7 @@ import type {AgentShareItem,NormalizedAgentShareConfig,} from '../schemas';-import { agents, agentShares, users } from '../schemas';+import { agents, agentShares, users, workspaces } from '../schemas';import type { LobeChatDatabase } from '../type';import { normalizeInboxAgentAvatar, normalizeInboxAgentTitle } from '../utils/inboxAgent';import { notTrashed } from '../utils/softDelete';@@ -654,10 +654,14 @@ export class AgentShareModel {userViewCount: agentShares.userViewCount,visibility: agentShares.visibility,workspaceId: agents.workspaceId,+ // Lets the owner's "settings" link land inside the share's Workspace+ // route instead of whichever Workspace happens to be active.+ workspaceSlug: workspaces.slug,}).from(agentShares).innerJoin(agents, eq(agentShares.agentId, agents.id)).leftJoin(users, eq(agents.userId, users.id))+ .leftJoin(workspaces, eq(agents.workspaceId, workspaces.id)).where(and(eq(agentShares.id, shareId), notTrashed(agents.isDeleted))).limit(1);diff --git a/packages/locales/src/default/agent.ts b/packages/locales/src/default/agent.tsindex c7ce69449c2..83bc0dbb06b 100644--- a/packages/locales/src/default/agent.ts+++ b/packages/locales/src/default/agent.ts@@ -403,20 +403,25 @@ export default {'share.entry': 'Share this Agent','share.settings.limits.desc':'Every visitor run is billed to your account, so these caps are what keep a shared link from running up your bill. They always apply — you can change the numbers, but not turn them off.',- 'share.settings.limits.maxFileStorage': 'File storage limit (MB)','share.settings.limits.maxFileStorageHint':'Files visitors attach are stored on your account. Uploads stop once they reach this total; set 0 to turn attachments off.',+ // Renamed from `maxFileStorage` when the MB unit moved into an input suffix: a new key lets+ // auto-i18n translate it, which it never does for a changed value under an existing key.+ 'share.settings.limits.maxFileStorageLabel': 'File storage limit','share.settings.limits.maxFileStorageWorkspaceHint':'Files visitors attach are stored in the Workspace. Uploads stop once they reach this total; set 0 to turn attachments off.','share.settings.limits.maxTopicsPerVisitor': 'Topics per visitor','share.settings.limits.maxTopicsPerVisitorHint':'How many separate topics each signed-in visitor can start.',+ 'share.settings.limits.maxTopicsPerVisitorUnit': 'topics','share.settings.limits.maxTurnsPerTopic': 'Turns per topic','share.settings.limits.maxTurnsPerTopicHint':'How many messages a visitor can send inside one topic.',- 'share.settings.limits.monthlySpendLimit': 'Monthly spend cap (M credits)',+ 'share.settings.limits.maxTurnsPerTopicUnit': 'turns',+ 'share.settings.limits.monthlySpendLimit': 'Monthly spend cap','share.settings.limits.monthlySpendLimitHint':'Visitor runs stop once this month’s spend on this Agent reaches the cap. Resets on the 1st of each month (UTC).',+ 'share.settings.limits.monthlySpendLimitUnit': 'M credits','share.settings.limits.title': 'Limits','share.settings.limits.workspaceDesc':'Every visitor run is billed to the Workspace budget, not to the visitor or any member quota. These per-Agent caps always apply — you can change the numbers, but not turn them off.',@@ -481,6 +486,11 @@ export default {'share.settings.usage.conversations': 'Topics','share.settings.usage.conversationsHint': 'Topics created by visitors through this share.','share.settings.usage.desc': 'What this share has attracted, and what it has cost you.',+ 'share.settings.usage.detail.desc':+ 'Every model call made by visitors of this share, billed to your account.',+ 'share.settings.usage.detail.title': 'Details',+ 'share.settings.usage.detail.workspaceDesc':+ 'Every model call made by visitors of this share, billed to the workspace.','share.settings.usage.fileStorage': 'File storage','share.settings.usage.fileStorageOfLimit': '{{used}} of {{limit}}','share.settings.usage.fileStorageOff': '{{used}} · attachments off',@@ -504,10 +514,14 @@ export default {'Could not load this Agent’s skills. Close and reopen the share settings to try again.','share.settings.skills.loading': 'Loading skills…','share.settings.skills.title': 'Skills visitors can use',+ 'share.settings.tools.apiNeedsApproval':+ 'This action needs your approval before it runs, and nobody can approve it during a shared run, so it stays off.',+ 'share.settings.tools.apiWritesOwnerDocuments':+ 'Visitors can never delete or copy your documents or change their load rules — this action stays off in shared runs.','share.settings.tools.desc':'Only the tools you tick here can be called during a visitor run. Tools that could reach your device or local files are never offered.','share.settings.tools.apiNotAvailableToVisitors':- 'This action can never be used in a shared run — it either needs your approval or is otherwise off-limits to visitors.',+ 'This action is never available to visitors in a shared run.','share.settings.tools.apiWritesOwnerData':'Visitors can never write to your memory — this action stays off in shared runs.','share.settings.tools.availableGroup': 'Not granted · {{count}}',@@ -749,4 +763,7 @@ export default {'share.settings.profile.featuredWorks.reload': 'Retry','share.settings.profile.featuredWorks.loadMore': 'Load more works','share.settings.profile.featuredWorks.unavailable': 'Unavailable work',+ 'share.settings.profile.unsaved':+ 'You have unsaved changes. Visitors will only see them after you save.',+ 'share.settings.profile.upToDate': 'Visitors see the saved content.',} as const;diff --git a/packages/types/src/agent/share.ts b/packages/types/src/agent/share.tsindex 0fc08698699..6a8869b769e 100644--- a/packages/types/src/agent/share.ts+++ b/packages/types/src/agent/share.ts@@ -105,6 +105,12 @@ export interface SharedAgentData {* "edit share" link) instead of the plain visitor UI.*/isOwner: boolean;+ /**+ * Slug of the Workspace that owns a Workspace share, returned only to its+ * owner so the "settings" link can open the share inside that Workspace+ * rather than the active one. Always `null` for visitors and personal shares.+ */+ ownerWorkspaceSlug: string | null;shareId: string;/** The share's custom URL slug, if the creator has set one. `null` otherwise. */slug: string | null;diff --git a/src/business/client/features/AgentShareSpendDetail.tsx b/src/business/client/features/AgentShareSpendDetail.tsxindex 8bdd01bb694..ce598320fc0 100644--- a/src/business/client/features/AgentShareSpendDetail.tsx+++ b/src/business/client/features/AgentShareSpendDetail.tsx@@ -1,5 +1,5 @@export interface AgentShareSpendDetailProps {- agentId: string;+ shareId: string;}/**