Skip to content

Commit 5bd7e26

Browse files
authored
fix(tarko): replace hardcoded texts with configurable title (#1174)
1 parent fea1084 commit 5bd7e26

15 files changed

Lines changed: 84 additions & 43 deletions

File tree

multimodal/omni-tars/core/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const toolCallEngine = createComposableToolCallEngineFactory({
8383
});
8484

8585
const agent = new ComposableAgent({
86-
name: 'Omni TARS Agent',
86+
name: 'Omni-TARS Agent',
8787
plugins: [mcpPlugin, guiPlugin, codePlugin],
8888
toolCallEngine,
8989
});

multimodal/omni-tars/omni-agent/tarko.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default defineConfig({
2929
logLevel: LogLevel.DEBUG,
3030
webui: {
3131
logo: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zyha-aulnh/ljhwZthlaukjlkulzlp/appicon.png',
32-
title: 'Omni TARS Agent',
32+
title: 'Omni-TARS Agent',
3333
subtitle: 'Offering seamless integration with a wide range of real-world tools.',
3434
welcomTitle: 'An multimodal AI agent',
3535
welcomePrompts: [

multimodal/tarko/agent-web-ui/src/common/constants/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,8 @@ export const CONNECTION_SETTINGS = {
8080
RECONNECTION_DELAY: 1000,
8181
RECONNECTION_DELAY_MAX: 5000,
8282
};
83+
84+
/**
85+
* Agent configuration
86+
*/
87+
export { getAgentTitle, getWebUIConfig, isContextualSelectorEnabled, getLogoUrl } from './shared';
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Shared configuration utilities for accessing dynamic web UI config
3+
*/
4+
5+
/**
6+
* Get web UI configuration from global window object
7+
* This config is injected by the server at runtime
8+
*/
9+
export function getWebUIConfig() {
10+
return window.AGENT_WEB_UI_CONFIG || {};
11+
}
12+
13+
/**
14+
* Get agent title from web UI config with fallback
15+
*/
16+
export function getAgentTitle(): string {
17+
return getWebUIConfig().title || 'Agent';
18+
}
19+
20+
/**
21+
* Check if contextual selector is enabled
22+
*/
23+
export function isContextualSelectorEnabled(): boolean {
24+
return getWebUIConfig().enableContextualSelector ?? false;
25+
}
26+
27+
/**
28+
* Get logo URL from web UI config with fallback
29+
*/
30+
export function getLogoUrl(): string {
31+
return (
32+
getWebUIConfig().logo ||
33+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/zyha-aulnh/ljhwZthlaukjlkulzlp/appicon.png'
34+
);
35+
}

multimodal/tarko/agent-web-ui/src/entry.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import './entry.css';
22

33
import React from 'react';
44
import ReactDOM from 'react-dom/client';
5-
import { AgentTARSWebUI } from './standalone/app';
5+
import { AgentWebUI } from './standalone/app';
66

77
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
88
<React.StrictMode>
9-
<AgentTARSWebUI />
9+
<AgentWebUI />
1010
</React.StrictMode>,
1111
);

multimodal/tarko/agent-web-ui/src/standalone/app/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import { useThemeInitialization } from '@/common/hooks/useThemeInitialization';
66
import { HashRouter, BrowserRouter } from 'react-router-dom';
77

88
/**
9-
* Agent TARS Web UI v2 - Entry Component
9+
* Agent Web UI v2 - Entry Component
1010
*
1111
* Provides the Jotai atom provider and initializes theme based on user preference.
1212
* Uses the enhanced ReplayModeProvider that now handles both context provision and initialization.
1313
*/
14-
export const AgentTARSWebUI: React.FC = () => {
14+
export const AgentWebUI: React.FC = () => {
1515
// Initialize theme based on user preference, defaulting to dark mode
1616
useThemeInitialization();
1717

multimodal/tarko/agent-web-ui/src/standalone/chat/ChatPanel.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { groupedMessagesAtom, messagesAtom } from '@/common/state/atoms/message'
1010
import { replayStateAtom } from '@/common/state/atoms/replay';
1111
import { useReplayMode } from '@/common/hooks/useReplayMode';
1212
import { useReplay } from '@/common/hooks/useReplay';
13+
import { getAgentTitle } from '@/common/constants';
1314

1415
import './ChatPanel.css';
1516
import { ResearchReportEntry } from './ResearchReportEntry';
@@ -196,7 +197,7 @@ export const ChatPanel: React.FC = () => {
196197
variants={itemVariants}
197198
className="text-xl font-display font-bold mb-3 text-gray-800 dark:text-gray-200"
198199
>
199-
Welcome to Agent TARS
200+
Welcome to {getAgentTitle()}
200201
</motion.h2>
201202
<motion.p
202203
variants={itemVariants}
@@ -211,7 +212,8 @@ export const ChatPanel: React.FC = () => {
211212
>
212213
<FiInfo className="mr-3 text-gray-400 flex-shrink-0" />
213214
<span>
214-
TARS can help with tasks involving web search, browsing, and file operations.
215+
{getAgentTitle()} can help with tasks involving web search, browsing, and file
216+
operations.
215217
</span>
216218
</motion.div>
217219
</div>
@@ -298,7 +300,7 @@ export const ChatPanel: React.FC = () => {
298300
<p className="text-gray-600 dark:text-gray-400 text-sm">
299301
{isReplayMode && replayState.currentEventIndex === -1
300302
? 'Press play to start the replay or use the timeline to navigate'
301-
: 'Ask Agent TARS a question or provide a command to begin.'}
303+
: `Ask ${getAgentTitle()} a question or submit a task.`}
302304
</p>
303305
</>
304306
)}

multimodal/tarko/agent-web-ui/src/standalone/chat/Message/components/MessageGroup.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { SkeletonLoader } from './SkeletonLoader';
1010
import { useAtomValue } from 'jotai';
1111
import { agentStatusAtom } from '@/common/state/atoms/ui';
1212
import { AgentProcessingPhase } from '@tarko/interface';
13+
import { getAgentTitle } from '@/common/constants';
1314

1415
interface MessageGroupProps {
1516
messages: MessageType[];
@@ -96,7 +97,7 @@ export const MessageGroup: React.FC<MessageGroupProps> = ({ messages, isThinking
9697
{isThinking && (
9798
<div className="mt-4 space-y-4">
9899
<ThinkingAnimation
99-
text={agentStatus.message || 'Agent TARS is running'}
100+
text={agentStatus.message || `${getAgentTitle()} is running`}
100101
phase={agentStatus.phase}
101102
estimatedTime={agentStatus.estimatedTime}
102103
showProgress={

multimodal/tarko/agent-web-ui/src/standalone/chat/Message/components/ThinkingAnimation.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { motion } from 'framer-motion';
33
import { FiCpu, FiZap, FiLoader, FiPlay } from 'react-icons/fi';
44
import { AgentProcessingPhase } from '@tarko/interface';
5+
import { getAgentTitle } from '@/common/constants';
56

67
interface ThinkingAnimationProps {
78
size?: 'small' | 'medium' | 'large';
@@ -110,7 +111,7 @@ const getGradientClasses = (phase?: string) => {
110111

111112
export const ThinkingAnimation: React.FC<ThinkingAnimationProps> = ({
112113
size = 'medium',
113-
text = 'Agent TARS is running',
114+
text = `${getAgentTitle()} is running`,
114115
className = '',
115116
phase,
116117
estimatedTime,

multimodal/tarko/agent-web-ui/src/standalone/chat/MessageInput/MessageAttachments.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ImagePreview } from '../ImagePreview';
66
import { ContextualTags } from '../ContextualTags';
77
import { ContextualItem } from '../ContextualSelector';
88
import { removeContextualItemAction } from '@/common/state/atoms/contextualSelector';
9+
import { isContextualSelectorEnabled } from '@/common/constants';
910

1011
interface MessageAttachmentsProps {
1112
images: ChatCompletionContentPart[];
@@ -26,10 +27,9 @@ export const MessageAttachments: React.FC<MessageAttachmentsProps> = ({
2627
const removeContextualItem = useSetAtom(removeContextualItemAction);
2728

2829
// Check if contextual selector is enabled
29-
const isContextualSelectorEnabled = window.AGENT_WEB_UI_CONFIG?.enableContextualSelector ?? false;
30+
const contextualSelectorEnabled = isContextualSelectorEnabled();
3031

31-
const hasAttachments =
32-
images.length > 0 || (isContextualSelectorEnabled && contextualItems.length > 0);
32+
const hasAttachments = images.length > 0 || (contextualSelectorEnabled && contextualItems.length > 0);
3333

3434
if (!hasAttachments) {
3535
return null;
@@ -38,7 +38,7 @@ export const MessageAttachments: React.FC<MessageAttachmentsProps> = ({
3838
return (
3939
<>
4040
{/* Contextual tags */}
41-
{isContextualSelectorEnabled && contextualItems.length > 0 && (
41+
{contextualSelectorEnabled && contextualItems.length > 0 && (
4242
<ContextualTags items={contextualItems} onRemove={removeContextualItem} />
4343
)}
4444

0 commit comments

Comments
 (0)