webapp/src/components/views/BackendProbe.tsx

(完整代码) 1KB

// Copyright (c) Microsoft. All rights reserved.

import { Body1, Spinner, Title3 } from '@fluentui/react-components';
import { FC, useEffect } from 'react';

interface IData {
    uri: string;
    onBackendFound: () => void;
}

const BackendProbe: FC<IData> = ({ uri, onBackendFound }) => {
    useEffect(() => {
        const requestUrl = new URL('probe', uri);
        const fetchAsync = async () => {
            try {
                var result = await fetch(requestUrl);

                if (result.ok) {
                    onBackendFound();
                }
            } catch {}
        };

        fetchAsync();
    });

    return (
        <div style={{ padding: 80, gap: 20, display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
            <Title3>Looking for your backend</Title3>
            <Spinner />
            <Body1>
                This sample expects to find a Semantic Kernel service from <strong>samples/apps/copilot-chat-app/webapi</strong>{' '}
                running at <strong>{uri}</strong>
            </Body1>
            <Body1>
                Run your Semantic Kernel service locally using{' '}
                Visual Studio, Visual Studio Code or by typing the following command:{' '}
                <strong>dotnet run</strong>
            </Body1>
        </div>
    );
};

export default BackendProbe;

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。