🤯 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
🐛 fix(home): strip markdown links from daily-brief input placeholder (#14635)
Arvin Xu0babdcfc00fa
diff --git a/src/routes/(main)/home/features/InputArea/__tests__/hintFormat.test.ts b/src/routes/(main)/home/features/InputArea/__tests__/hintFormat.test.tsnew file mode 100644index 00000000000..13cd0a3fedb--- /dev/null+++ b/src/routes/(main)/home/features/InputArea/__tests__/hintFormat.test.ts@@ -0,0 +1,40 @@+// @vitest-environment node+import { describe, expect, it } from 'vitest';++import { stripMarkdownLinks } from '../hintFormat';++describe('stripMarkdownLinks', () => {+ it('keeps plain text unchanged', () => {+ expect(stripMarkdownLinks('帮我整理方向调研...')).toBe('帮我整理方向调研...');+ });++ it('replaces a single markdown link with its label', () => {+ expect(stripMarkdownLinks('看下 [Bug #14153](/agent/agt_x/tpc_y) 的进度...')).toBe(+ '看下 Bug #14153 的进度...',+ );+ });++ it('replaces multiple markdown links in one string', () => {+ expect(+ stripMarkdownLinks(+ '帮我整理 [2.1 改版](/agent/inbox/tpc_a) 和 [LOBE-8516](/task/T-1) 的下一步...',+ ),+ ).toBe('帮我整理 2.1 改版 和 LOBE-8516 的下一步...');+ });++ it('preserves the trailing ellipsis used as a typing indicator', () => {+ expect(stripMarkdownLinks('看下 [Bug](/agent/x/y) 的 PR 进度...')).toBe(+ '看下 Bug 的 PR 进度...',+ );+ });++ it('passes through non-link brackets', () => {+ expect(stripMarkdownLinks('Try [option] without a URL')).toBe('Try [option] without a URL');+ });++ it('handles labels containing brackets in their visible label edge case', () => {+ // Label has no `]` — current pattern keeps the first matching `]`. We+ // accept this trade-off; entity titles rarely contain `]`.+ expect(stripMarkdownLinks('[Title](/path) trailing')).toBe('Title trailing');+ });+});diff --git a/src/routes/(main)/home/features/InputArea/hintFormat.ts b/src/routes/(main)/home/features/InputArea/hintFormat.tsnew file mode 100644index 00000000000..6545eb11316--- /dev/null+++ b/src/routes/(main)/home/features/InputArea/hintFormat.ts@@ -0,0 +1,12 @@+/**+ * Replace `[label](url)` markdown links with their visible label only.+ *+ * The daily-brief hint generated by the home-brief prompt wraps every+ * referenced entity in the same `[name](url)` form as welcome — that lets+ * the LLM keep a stable entity reference, and lets the agent resolve the+ * link target when the user submits via the hint placeholder. We strip the+ * link syntax for placeholder display so the visible text is clean; the+ * raw hint (with markdown) still flows through to `useSend`.+ */+export const stripMarkdownLinks = (text: string): string =>+ text.replaceAll(/\[([^\]]+)\]\([^)]*\)/g, '$1');diff --git a/src/routes/(main)/home/features/InputArea/index.tsx b/src/routes/(main)/home/features/InputArea/index.tsxindex e4714d1a086..9e23e025642 100644--- a/src/routes/(main)/home/features/InputArea/index.tsx+++ b/src/routes/(main)/home/features/InputArea/index.tsx@@ -14,6 +14,7 @@ import { systemStatusSelectors } from '@/store/global/selectors';import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';import BotIntegrationBanner, { BOT_INTEGRATION_BANNER_ID } from './BotIntegrationBanner';+import { stripMarkdownLinks } from './hintFormat';import SkillInstallBanner, { SKILL_INSTALL_BANNER_ID } from './SkillInstallBanner';import StarterList from './StarterList';import { useSend } from './useSend';@@ -99,7 +100,7 @@ const InputArea = () => {// tracks whichever pair the WelcomeText typewriter is currently showing,// via the shared rotating index inside `useHomeDailyBrief`.const { currentPair } = useHomeDailyBrief();- const dailyHint = currentPair?.hint;+ const dailyHint = currentPair?.hint ? stripMarkdownLinks(currentPair.hint) : undefined;return (<Flexbox gap={16} style={{ marginBottom: 16 }}>