Skip to content

Commit 47f9a38

Browse files
yomybabyCopilot
andcommitted
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 12b358b commit 47f9a38

4 files changed

Lines changed: 10 additions & 38 deletions

File tree

pnpm-lock.yaml

Lines changed: 0 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react/src/components/ComputeSessionNodeItems/AppLauncherModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const AppLauncherModal: React.FC<AppLauncherModalProps> = ({
111111

112112
// Tensorboard - show path input modal BEFORE starting proxy
113113
// This matches legacy behavior where modal is shown first, then proxy starts after path submission
114-
if (app?.name === 'tensorboard') {
114+
if (app.name === 'tensorboard') {
115115
setOpenTensorboardModal(true);
116116
return;
117117
}

react/src/components/ComputeSessionNodeItems/VSCodeDesktopConnectionModal.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
'use memo';
2-
3-
import SourceCodeViewer from '../SourceCodeViewer';
1+
import SourceCodeView from '../SourceCodeView';
42
import { Descriptions, Skeleton, Typography } from 'antd';
53
import {
64
BAIButton,
@@ -22,6 +20,7 @@ interface VSCodeDesktopConnectionModalProps extends BAIModalProps {
2220
const VSCodeDesktopConnectionModal: React.FC<
2321
VSCodeDesktopConnectionModalProps
2422
> = ({ sessionId, host = '127.0.0.1', port, ...modalProps }) => {
23+
'use memo';
2524
const { t } = useTranslation();
2625
const baiClient = useSuspendedBackendaiClient();
2726

@@ -90,7 +89,7 @@ const VSCodeDesktopConnectionModal: React.FC<
9089
<Typography.Text>
9190
{t('session.VSCodeRemoteNoticeSSHConfig')}
9291
</Typography.Text>
93-
<SourceCodeViewer language="shell">{sshConfig}</SourceCodeViewer>
92+
<SourceCodeView language="shell">{sshConfig}</SourceCodeView>
9493

9594
<BAIButton href={vscodeUri} target="_blank" type="primary" size="large">
9695
{t('session.appLauncher.OpenVSCodeRemote')}

react/src/hooks/useBackendAIAppLauncher.tsx

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,7 @@ export const useBackendAIAppLauncher = (
393393
const { appConnectUrl, reused, redirectUrl } = await _connectToProxyWorker(
394394
response.url,
395395
'',
396-
!TCP_APPS.includes(app) || globalThis.isElectron,
397-
// ^^ false for TCP apps in browser, true otherwise
396+
!TCP_APPS.includes(app) || globalThis.isElectron, // Enable direct TCP for non-TCP apps, or when running in Electron
398397
);
399398

400399
// Initialize TCP connection info variables
@@ -746,7 +745,6 @@ export const useBackendAIAppLauncher = (
746745
};
747746
};
748747

749-
// @ts-ignore
750748
return {
751749
/**
752750
* Convenience method to launch terminal (ttyd) app.
@@ -831,18 +829,6 @@ export const useBackendAIAppLauncher = (
831829
* Used when re-launching apps like tensorboard that need to be restarted with different args.
832830
*/
833831
closeWsproxy: _close_wsproxy,
834-
// TODO: implement below function
835-
// showLauncher: (params: {
836-
// 'session-uuid'?: string;
837-
// 'access-key'?: string;
838-
// 'app-services'?: string;
839-
// mode?: string;
840-
// 'app-services-option'?: string;
841-
// 'service-ports'?: string;
842-
// runtime?: string;
843-
// filename?: string;
844-
// arguments?: string;
845-
// }) => {},
846832
};
847833
};
848834

@@ -874,7 +860,11 @@ class AppLaunchError extends Error {
874860
* @param request - Request configuration object
875861
* @returns Parsed response body or error object with status
876862
*/
877-
async function sendRequest(request: any) {
863+
interface SendRequestConfig extends RequestInit {
864+
uri: string;
865+
method?: string;
866+
}
867+
async function sendRequest(request: SendRequestConfig) {
878868
try {
879869
if (request.method === 'GET') {
880870
request.body = undefined;

0 commit comments

Comments
 (0)