mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 20:50:34 +00:00
fix ui
This commit is contained in:
parent
0c21071bf6
commit
a02ed08d26
4 changed files with 8 additions and 14 deletions
|
|
@ -634,7 +634,7 @@ export const MCPManagementDialog: React.FC<MCPManagementDialogProps> = ({
|
|||
footerText = t('Esc to back');
|
||||
break;
|
||||
case MCP_MANAGEMENT_STEPS.AUTHENTICATE:
|
||||
footerText = t('Press Enter to start authentication, Esc to go back');
|
||||
footerText = t('Esc to go back');
|
||||
break;
|
||||
default:
|
||||
footerText = t('Esc to close');
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { useState, useCallback, useRef } from 'react';
|
||||
import { useState, useCallback, useRef, useEffect } from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { theme } from '../../../semantic-colors.js';
|
||||
import { useKeypress } from '../../../hooks/useKeypress.js';
|
||||
|
|
@ -102,16 +102,14 @@ export const AuthenticateStep: React.FC<AuthenticateStepProps> = ({
|
|||
}
|
||||
}, [server, config, onSuccess]);
|
||||
|
||||
useEffect(() => {
|
||||
runAuthentication();
|
||||
});
|
||||
|
||||
useKeypress(
|
||||
(key) => {
|
||||
if (key.name === 'escape') {
|
||||
onBack();
|
||||
} else if (key.name === 'return') {
|
||||
if (authState === 'idle') {
|
||||
void runAuthentication();
|
||||
} else if (authState === 'success' || authState === 'error') {
|
||||
onBack();
|
||||
}
|
||||
}
|
||||
},
|
||||
{ isActive: true },
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ export const ServerDetailStep: React.FC<ServerDetailStepProps> = ({
|
|||
value: 'toggle-disable',
|
||||
});
|
||||
|
||||
// 只在服务器配置了 OAuth 时显示认证选项
|
||||
// 待补充准确的认证判断方案,暂时全部开放
|
||||
if (!server.isDisabled) {
|
||||
result.push({
|
||||
key: 'authenticate',
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ export const ServerListStep: React.FC<ServerListStepProps> = ({
|
|||
[servers],
|
||||
);
|
||||
|
||||
// 动态计算服务器名称列的最大宽度(基于实际内容)
|
||||
const serverNameWidth = useMemo(() => {
|
||||
if (servers.length === 0) return 20;
|
||||
const maxLength = Math.max(...servers.map((s) => s.name.length));
|
||||
|
|
@ -35,7 +34,6 @@ export const ServerListStep: React.FC<ServerListStepProps> = ({
|
|||
return Math.min(Math.max(maxLength + 2, 20), 35);
|
||||
}, [servers]);
|
||||
|
||||
// 计算扁平化的服务器列表用于导航
|
||||
const flatServers = useMemo(() => {
|
||||
const result: MCPServerDisplayInfo[] = [];
|
||||
for (const group of groupedServers) {
|
||||
|
|
@ -44,7 +42,6 @@ export const ServerListStep: React.FC<ServerListStepProps> = ({
|
|||
return result;
|
||||
}, [groupedServers]);
|
||||
|
||||
// 键盘导航
|
||||
useKeypress(
|
||||
(key) => {
|
||||
if (key.name === 'up') {
|
||||
|
|
@ -71,7 +68,6 @@ export const ServerListStep: React.FC<ServerListStepProps> = ({
|
|||
);
|
||||
}
|
||||
|
||||
// 计算当前选中项在分组中的位置
|
||||
const getSelectionPosition = (globalIndex: number) => {
|
||||
let currentIndex = 0;
|
||||
for (const group of groupedServers) {
|
||||
|
|
@ -169,7 +165,7 @@ export const ServerListStep: React.FC<ServerListStepProps> = ({
|
|||
|
||||
{/* 提示信息 */}
|
||||
{servers.some((s) => s.status === 'disconnected' && !s.isDisabled) && (
|
||||
<Box>
|
||||
<Box marginTop={1}>
|
||||
<Text color={theme.status.warning}>
|
||||
※ {t('Run qwen --debug to see error logs')}
|
||||
</Text>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue