feat: update main chat and system chat UI

This commit is contained in:
2026-05-25 17:26:37 +09:00
parent fb5ec649cd
commit f59522ffc4
120 changed files with 43262 additions and 3325 deletions

View File

@@ -17,25 +17,31 @@ export type PlanSectionKey =
| 'history'
| 'automation-type'
| 'automation-context'
| 'token-setting'
| 'shared-resource'
| 'server-command';
export type ChatSectionKey = 'live' | 'changes' | 'resources' | 'errors' | 'manage' | 'manage-defaults';
export type PlaySectionKey = 'layout' | 'test' | 'cbt';
export type ChatSectionKey = 'live' | 'rooms' | 'changes' | 'resources' | 'errors' | 'manage' | 'manage-defaults' | 'manage-share';
export type PlaySectionKey = 'layout' | 'draw' | 'apps' | 'test' | 'cbt';
export type PlaySidebarKey = PlaySectionKey | `layout-record:${string}`;
export const CHAT_SECTION_GROUP_LABELS: Record<ChatSectionKey, string> = {
live: 'Codex Live',
rooms: '시스템 채팅',
changes: 'Codex Live',
resources: '리소스 관리',
errors: '앱로그',
manage: '채팅 관리',
'manage-defaults': '채팅 관리',
'manage-share': '채팅 관리',
};
export const CHAT_SECTION_LABELS: Record<ChatSectionKey, string> = {
live: 'Codex Live',
rooms: '시스템 채팅',
changes: '변경 이력',
resources: '리소스 관리',
errors: '에러 로그',
manage: '유형 권한 관리',
'manage-defaults': '공통 문맥 관리',
'manage-share': '공유채팅 생성',
};
export const DOCS_DEFAULT_FOLDER = 'project';
@@ -64,11 +70,15 @@ export const PLAN_SIDEBAR_LABELS: Record<PlanSectionKey, string> = {
history: '이력',
'automation-type': '자동화 유형',
'automation-context': 'Context 유형',
'token-setting': '설정',
'shared-resource': '공유 리소스 관리',
'server-command': 'Command',
};
export const PLAY_SIDEBAR_LABELS: Record<PlaySectionKey, string> = {
layout: 'Layout Editor',
draw: 'Layout Draw',
apps: 'Apps',
test: 'Test App',
cbt: 'CBT',
};
@@ -86,6 +96,8 @@ export const PLAN_MENU_ANCHOR_IDS: Partial<Record<PlanSectionKey, string>> = {
history: 'plan-menu-history',
'automation-type': 'plan-menu-automation-type',
'automation-context': 'plan-menu-automation-context',
'token-setting': 'plan-menu-token-setting',
'shared-resource': 'plan-menu-shared-resource',
'server-command': 'plan-menu-server-command',
};
@@ -104,7 +116,13 @@ export function resolveSavedLayoutIdFromMenuKey(key: PlaySidebarKey) {
export function resolvePlaySidebarLabel(selectedPlayMenu: PlaySidebarKey, savedLayouts: Array<{ id: string; name: string }>) {
const savedLayoutId = resolveSavedLayoutIdFromMenuKey(selectedPlayMenu);
if (selectedPlayMenu === 'layout' || selectedPlayMenu === 'test' || selectedPlayMenu === 'cbt') {
if (
selectedPlayMenu === 'layout' ||
selectedPlayMenu === 'draw' ||
selectedPlayMenu === 'apps' ||
selectedPlayMenu === 'test' ||
selectedPlayMenu === 'cbt'
) {
return PLAY_SIDEBAR_LABELS[selectedPlayMenu];
}
@@ -141,6 +159,36 @@ export function buildPlayPath(section: PlaySectionKey = 'layout') {
return `/play/${section}`;
}
function normalizePlayAppReturnToPath(returnTo: string | null | undefined) {
if (!returnTo || !returnTo.startsWith('/') || returnTo.startsWith('//')) {
return null;
}
return returnTo;
}
export function buildPlayAppPath(
appId: string,
launchContext: 'direct' | 'embedded' = 'direct',
returnTo?: string | null,
) {
const searchParams = new URLSearchParams({
app: appId,
});
if (launchContext === 'embedded') {
searchParams.set('launchContext', launchContext);
}
const normalizedReturnTo = normalizePlayAppReturnToPath(returnTo);
if (normalizedReturnTo) {
searchParams.set('returnTo', normalizedReturnTo);
}
return `/play/apps?${searchParams.toString()}`;
}
export function buildSavedLayoutPath(layoutId: string) {
return `/play/layout-record/${layoutId}`;
}
@@ -227,6 +275,21 @@ export function buildPlanMenuItems(hasAccess = true): MenuProps['items'] {
},
],
},
{
key: 'token-management-group',
icon: <ProfileOutlined />,
label: '토큰관리',
children: [
{
key: 'token-setting',
label: renderPlanMenuLabel('token-setting', PLAN_SIDEBAR_LABELS['token-setting']),
},
{
key: 'shared-resource',
label: renderPlanMenuLabel('shared-resource', PLAN_SIDEBAR_LABELS['shared-resource']),
},
],
},
{
key: 'server-group',
icon: <ProfileOutlined />,
@@ -256,11 +319,12 @@ function renderChatUnreadLabel(label: string, unreadCount: number) {
export function buildChatMenuItems(_hasAccess = true, unreadCount = 0): MenuProps['items'] {
return [
{
key: 'codex-live-group',
key: 'chat-group',
icon: <MessageOutlined />,
label: renderChatUnreadLabel('Codex Live', unreadCount),
label: renderChatUnreadLabel('채팅', unreadCount),
children: [
{ key: 'live', label: renderChatUnreadLabel('Codex Live', unreadCount) },
{ key: 'live', label: 'Codex Live' },
{ key: 'rooms', label: '시스템 채팅' },
{ key: 'changes', label: '변경 이력' },
{ key: 'resources', label: '리소스 관리' },
],
@@ -278,6 +342,7 @@ export function buildChatMenuItems(_hasAccess = true, unreadCount = 0): MenuProp
children: [
{ key: 'manage', label: '유형 권한 관리' },
{ key: 'manage-defaults', label: '공통 문맥 관리' },
{ key: 'manage-share', label: '공유채팅 생성' },
],
},
];
@@ -295,6 +360,7 @@ export function buildPlayMenuItems(savedLayouts: Array<{ id: string; name: strin
label: 'Layout',
children: [
{ key: 'layout', label: 'Layout Editor' },
{ key: 'draw', label: 'Layout Draw' },
...(savedLayouts.length
? savedLayouts.map((record) => ({
key: resolveSavedLayoutMenuKey(record.id),
@@ -307,6 +373,7 @@ export function buildPlayMenuItems(savedLayouts: Array<{ id: string; name: strin
key: 'play-apps-group',
label: 'Apps',
children: [
{ key: 'apps', label: 'Apps' },
{ key: 'test', label: 'Test App' },
{
key: 'play-apps-general-group',
@@ -321,7 +388,7 @@ export function buildPlayMenuItems(savedLayouts: Array<{ id: string; name: strin
}
export function resolvePlanOpenKeys() {
return ['plan-group', 'server-group', 'codex-live-group', 'app-log-group', 'chat-manage-group'];
return ['plan-group', 'token-management-group', 'server-group', 'chat-group', 'app-log-group', 'chat-manage-group'];
}
export function resolvePlayOpenKeys() {
@@ -380,7 +447,12 @@ export function resolveCurrentPageDescriptor(params: {
}
if (topMenu === 'plans') {
const title = planMenu === 'server-command' ? `Servers / ${PLAN_SIDEBAR_LABELS[planMenu]}` : `${PLAN_GROUP_LABEL} / ${PLAN_SIDEBAR_LABELS[planMenu]}`;
const title =
planMenu === 'server-command'
? `Servers / ${PLAN_SIDEBAR_LABELS[planMenu]}`
: planMenu === 'token-setting' || planMenu === 'shared-resource'
? `토큰관리 / ${PLAN_SIDEBAR_LABELS[planMenu]}`
: `${PLAN_GROUP_LABEL} / ${PLAN_SIDEBAR_LABELS[planMenu]}`;
return {
id: `plans:${planMenu}`,