Refactor variable of front end (#13953)

### What problem does this PR solve?

api_host -> webAPI
ExternalApi -> restAPIv1

### Type of change

- [x] Refactoring


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Updated internal API endpoint configuration to use consolidated base
URL constants for improved maintainability and consistency across the
application.

* **Chores**
* Updated server-side protocol validation for admin connectivity checks.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-04-07 15:08:11 +08:00
committed by GitHub
parent 38acf34724
commit 393efa9b7c
7 changed files with 251 additions and 263 deletions

View File

@@ -1,7 +1,7 @@
import { Authorization } from '@/constants/authorization';
import { useGetKnowledgeSearchParams } from '@/hooks/route-hook';
import { useGetPipelineResultSearchParams } from '@/pages/dataflow-result/hooks';
import api, { api_host } from '@/utils/api';
import api, { webAPI } from '@/utils/api';
import { getAuthorization } from '@/utils/authorization-util';
import jsPreviewExcel from '@js-preview/excel';
import { useSize } from 'ahooks';
@@ -57,7 +57,7 @@ export const useGetDocumentUrl = (isAgent: boolean) => {
if (isAgent) {
return api.downloadFile + `?id=${id}&created_by=${createdBy}`;
}
return `${api_host}/document/get/${documentId}`;
return `${webAPI}/document/get/${documentId}`;
}, [createdBy, documentId, id, isAgent]);
return url;

View File

@@ -1,4 +1,4 @@
import { api_host } from '@/utils/api';
import { webAPI } from '@/utils/api';
import classNames from 'classnames';
import React from 'react';
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
@@ -13,7 +13,7 @@ const Image = ({ id, t, label, className, ...props }: IImage) => {
const imageElement = (
<img
{...props}
src={`${api_host}/document/image/${id}${t ? `?_t=${t}` : ''}`}
src={`${webAPI}/document/image/${id}${t ? `?_t=${t}` : ''}`}
className={classNames('max-w-[45vw] max-h-[40wh] block', className)}
/>
);

View File

@@ -7,7 +7,7 @@ import {
CarouselPrevious,
} from '@/components/ui/carousel';
import { IReferenceChunk } from '@/interfaces/database/chat';
import { api_host } from '@/utils/api';
import { webAPI } from '@/utils/api';
import { isPlainObject } from 'lodash';
import { RotateCw, ZoomIn, ZoomOut } from 'lucide-react';
import { useMemo } from 'react';
@@ -79,7 +79,7 @@ function ImageCarousel({ images }: { images: ImageItem[] }) {
@2xl:basis-1/6
"
>
<PhotoView src={`${api_host}/document/image/${id}`}>
<PhotoView src={`${webAPI}/document/image/${id}`}>
<Image
id={id}
className="h-40 w-full"