Compare commits

...
Author SHA1 Message Date
jialin 57f4ddad26 chore: remove --port backend parameter 2025-06-05 11:29:54 +08:00
jialin de34d0ae00 fix: instances distribute info trigger by click 2025-06-05 11:24:09 +08:00
jialin 4f7037baa0 chore: reset changes on catalog 2025-06-03 18:10:39 +08:00
jialin bd15e9aa6c fix: tips for css files load failed 2025-06-03 16:28:03 +08:00
jialin 907105a492 fix: set default spec to form 2025-06-03 15:35:38 +08:00
gitlawr 0d3da04356 ci: publish v*-dev branches 2025-05-30 13:20:40 +08:00
12 changed files with 139 additions and 30 deletions
+18 -8
View File
@@ -4,11 +4,13 @@ on:
push:
branches:
- 'main'
- 'v*-dev'
tags:
- '*.*.*'
pull_request:
branches:
- 'main'
- 'v*-dev'
env:
NODE_VERSION: '21'
@@ -72,11 +74,6 @@ jobs:
if: github.event_name == 'push'
timeout-minutes: 30
runs-on: ubuntu-22.04
strategy:
matrix:
version: ['latest', '${{ github.ref_name }}']
exclude:
- version: 'main'
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -92,10 +89,23 @@ jobs:
${{ github.workspace }}/node_modules
- name: Build
run: scripts/build
- name: Determine Version
id: version
run: |
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
echo "version=latest" >> $GITHUB_OUTPUT
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
elif [[ "${GITHUB_REF}" == refs/heads/v*-dev ]]; then
echo "version=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
else
echo "Not a publish target"
exit 1
fi
- name: Package
run: scripts/package
env:
VERSION: '${{ matrix.version }}'
VERSION: '${{ steps.version.outputs.version }}'
- name: Release
uses: TencentCloud/cos-action@b0aa648235fb35a1bdd6a77f529eb0ac4c2f1c25
with:
@@ -103,7 +113,7 @@ jobs:
secret_key: ${{ secrets.CI_TECENTCOS_SECRET_KEY }}
cos_bucket: ${{ secrets.COS_BUCKET }}
cos_region: ${{ secrets.COS_REGION }}
local_path: dist/${{ matrix.version }}.tar.gz
remote_path: releases/${{ matrix.version }}.tar.gz
local_path: dist/${{ steps.version.outputs.version }}.tar.gz
remote_path: releases/${{ steps.version.outputs.version }}.tar.gz
accelerate: true
clean: false
+1
View File
@@ -29,6 +29,7 @@
"@umijs/max": "^4.2.11",
"@xterm/addon-fit": "^0.10.0",
"@xterm/xterm": "^5.5.0",
"ahooks": "^3.8.5",
"ansi-to-html": "^0.7.2",
"antd": "^5.21.6",
"antd-style": "^3.6.2",
+12 -8
View File
@@ -47,6 +47,9 @@ dependencies:
'@xterm/xterm':
specifier: ^5.5.0
version: 5.5.0
ahooks:
specifier: ^3.8.5
version: 3.8.5(react@18.2.0)
ansi-to-html:
specifier: ^0.7.2
version: 0.7.2
@@ -290,7 +293,7 @@ packages:
'@umijs/bundler-utils': 4.2.8
'@umijs/plugins': 4.2.8(@babel/core@7.26.0)(@types/react-dom@18.3.0)(@types/react@18.3.1)(antd@5.21.6)(dva@2.5.0-beta.2)(rc-field-form@2.7.0)(react-dom@18.2.0)(react@18.2.0)
'@umijs/utils': 4.2.8
ahooks: 3.8.0(react@18.2.0)
ahooks: 3.8.5(react@18.2.0)
antd-mobile-alita: 2.3.4(react-dom@18.2.0)(react@18.2.0)
antd-mobile-icons: 0.2.2
babel-plugin-import: 1.13.8
@@ -7595,22 +7598,22 @@ packages:
dev: false
optional: true
/ahooks@3.8.0(react@18.2.0):
resolution: {integrity: sha512-M01m+mxLRNNeJ/PCT3Fom26UyreTj6oMqJBetUrJnK4VNI5j6eMA543Xxo53OBXn6XibA2FXKcCCgrT6YCTtKQ==, tarball: https://registry.npmjs.org/ahooks/-/ahooks-3.8.0.tgz}
/ahooks@3.8.5(react@18.2.0):
resolution: {integrity: sha512-Y+MLoJpBXVdjsnnBjE5rOSPkQ4DK+8i5aPDzLJdIOsCpo/fiAeXcBY1Y7oWgtOK0TpOz0gFa/XcyO1UGdoqLcw==, tarball: https://registry.npmjs.org/ahooks/-/ahooks-3.8.5.tgz}
engines: {node: '>=8.0.0'}
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
dependencies:
'@babel/runtime': 7.26.0
dayjs: 1.11.11
intersection-observer: 0.12.2
js-cookie: 2.2.1
js-cookie: 3.0.5
lodash: 4.17.21
react: 18.2.0
react-fast-compare: 3.2.2
resize-observer-polyfill: 1.5.1
screenfull: 5.2.0
tslib: 2.6.2
tslib: 2.8.1
dev: false
/ajv-formats@2.1.1(ajv@8.13.0):
@@ -12759,8 +12762,9 @@ packages:
react: 18.2.0
dev: false
/js-cookie@2.2.1:
resolution: {integrity: sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==, tarball: https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz}
/js-cookie@3.0.5:
resolution: {integrity: sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==, tarball: https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz}
engines: {node: '>=14'}
dev: false
/js-sdsl@4.4.2:
+7 -2
View File
@@ -7,10 +7,14 @@ interface UploadAudioProps {
accept?: string;
maxCount?: number;
type?: 'text' | 'primary' | 'default';
icon?: React.ReactNode;
size?: 'small' | 'middle' | 'large';
shape?: 'circle' | 'round' | 'default';
onChange?: (data: { file: any; fileList: any[] }) => void;
}
const UploadAudio: React.FC<UploadAudioProps> = (props) => {
const { icon, accept, type, size = 'large', shape = 'circle' } = props;
const intl = useIntl();
const beforeUpload = (file: any) => {
return false;
@@ -48,9 +52,10 @@ const UploadAudio: React.FC<UploadAudioProps> = (props) => {
}}
>
<Button
icon={<UploadOutlined />}
size={size}
icon={icon ?? <UploadOutlined />}
type={props.type ?? 'text'}
shape="circle"
shape={shape}
></Button>
</div>
</Upload>
+4 -1
View File
@@ -16,7 +16,10 @@ interface ErrorResultProps {
function isChunkLoadError(msg?: string): boolean {
if (typeof msg !== 'string') return false;
return msg.includes('Loading chunk') && msg.includes('failed');
const jsChunkFailed = msg.includes('Loading chunk');
const cssChunkFailed = msg.includes('Loading CSS chunk');
return (jsChunkFailed || cssChunkFailed) && msg.includes('failed');
}
const ErrorResult: React.FC<ErrorResultProps> = ({ extra }) => {
+26 -4
View File
@@ -36,6 +36,12 @@ const resetFields = [
'env'
];
const resetFieldsByFile = [
'cpu_offloading',
'distributed_inference_across_workers',
'backend_parameters'
];
const ModalFooterStyle = {
padding: '16px 24px',
display: 'flex',
@@ -94,6 +100,7 @@ const AddModal: FC<AddModalProps> = (props) => {
handleBackendChangeBefore,
cancelEvaluate,
handleOnValuesChange,
handleEvaluateOnChange,
warningStatus,
submitAnyway
} = useCheckCompatibility();
@@ -135,22 +142,37 @@ const AddModal: FC<AddModalProps> = (props) => {
return categories || null;
};
const handleSelectModelFile = (item: any, evaluate?: boolean) => {
form.current?.form?.resetFields(resetFields);
const handleSelectModelFile = async (item: any, evaluate?: boolean) => {
form.current?.form?.resetFields(resetFieldsByFile);
const modelInfo = onSelectModel(selectedModel, props.source);
form.current?.setFieldsValue?.({
file_name: item.fakeName,
...getDefaultSpec(item),
...modelInfo,
categories: getCategory(item)
});
await new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, 0);
});
if (item.fakeName) {
handleOnValuesChange?.({
const evaluateRes = await handleEvaluateOnChange?.({
changedValues: {},
allValues: form.current?.form?.getFieldsValue?.(),
source: props.source
});
const defaultSpec = getDefaultSpec({
evaluateResult: evaluateRes
});
console.log('defaultSpec', defaultSpec);
form.current?.setFieldsValue?.({
file_name: item.fakeName,
...defaultSpec,
...modelInfo,
categories: getCategory(item)
});
}
};
@@ -478,7 +478,7 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
return (
<TooltipOverlayScroller
toolTipProps={{
trigger: 'click',
trigger: 'hover',
overlayInnerStyle: {
width: 'max-content',
maxWidth: '520px',
+16 -4
View File
@@ -11,10 +11,6 @@ const options = [
label: '--host',
value: '--host'
},
{
label: '--port',
value: '--port'
},
{
label: '--timeout',
value: '--timeout'
@@ -592,6 +588,22 @@ const options = [
{
label: '--context-shift',
value: '--context-shift'
},
{
label: '--visual-max-image-cache',
value: '--visual-max-image-cache'
},
{
label: '--max-projected-cache',
value: '--max-projected-cache'
},
{
label: '--swa-full',
value: '--swa-full'
},
{
label: '--no-enable-reasoning',
value: '--no-enable-reasoning'
}
];
+7 -2
View File
@@ -7,6 +7,7 @@ import {
import { ListItem as WorkerListItem } from '@/pages/resources/config/types';
import { convertFileSize } from '@/utils';
import { useIntl } from '@umijs/max';
import { useDebounceFn } from 'ahooks';
import _ from 'lodash';
import { useEffect, useRef, useState } from 'react';
import { evaluationsModelSpec, queryGPUList } from '../apis';
@@ -522,7 +523,7 @@ export const useCheckCompatibility = () => {
cacheFormValuesRef.current = allValues;
const data = getSourceRepoConfigValue(source, allValues);
const gpuSelector = generateGPUIds(data.values);
await handleDoEvalute({
return await handleDoEvalute({
...data.values,
...gpuSelector
});
@@ -546,7 +547,10 @@ export const useCheckCompatibility = () => {
return res;
};
const debounceHandleValuesChange = _.debounce(handleOnValuesChange, 500);
const { run: debounceHandleValuesChange } = useDebounceFn(
handleOnValuesChange,
{ wait: 500 }
);
const cancelEvaluate = () => {
checkTokenRef.current?.cancel();
@@ -570,6 +574,7 @@ export const useCheckCompatibility = () => {
cancelEvaluate,
handleBackendChangeBefore,
handleOnValuesChange: debounceHandleValuesChange,
handleEvaluateOnChange: handleOnValuesChange,
warningStatus,
checkTokenRef,
submitAnyway
@@ -1,5 +1,6 @@
import IconFont from '@/components/icon-font';
import HotKeys, { KeyMap } from '@/config/hotkeys';
import { convertFileToBase64 } from '@/utils/load-audio-file';
import { ClearOutlined, SendOutlined, SwapOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max';
import { Button, Checkbox, Divider, Input, Tooltip } from 'antd';
@@ -19,6 +20,12 @@ import '../style/message-input.less';
import ThumbImg from './thumb-img';
import UploadImg from './upload-img';
const audioTypeMap: Record<string, string> = {
'audio/wav': 'wav',
'audio/mp3': 'mp3',
'audio/mpeg': 'mp3'
};
type CurrentMessage = Omit<MessageItem, 'uid'>;
type ActionType =
@@ -260,6 +267,26 @@ const MessageInput: React.FC<MessageInputProps> = forwardRef(
});
};
const handleUploadAudioChange = async (data: {
file: any;
fileList: any[];
}) => {
// convert audio file to base64
try {
console.log('audio file====', data.file);
const base64Audio = await convertFileToBase64(data.file);
setMessage({
...message,
audio: {
format: audioTypeMap[data.file.type],
dataUrl: base64Audio
}
});
} catch (error) {
console.error('Error converting audio to Base64:', error);
}
};
const handleDeleteImg = (uid: number | string) => {
const list = _.filter(
message.imgs,
@@ -360,6 +387,16 @@ const MessageInput: React.FC<MessageInputProps> = forwardRef(
size="middle"
></UploadImg>
)}
{/* {actions.includes('upload') && message.role === Roles.User && (
<UploadAudio
type="text"
accept={'.mp3,.wav'}
size="middle"
shape="default"
icon={<CustomerServiceOutlined />}
onChange={handleUploadAudioChange}
></UploadAudio>
)} */}
{tools}
{actions.includes('clear') && (
<Tooltip
+1
View File
@@ -16,6 +16,7 @@ export type MessageItemAction =
export interface MessageItem {
content: string;
imgs?: { uid: string | number; dataUrl: string }[];
audio?: { uid: string | number; dataUrl: string; format: 'wav' | 'mp3' };
role: string;
title?: React.ReactNode;
uid: number;
+9
View File
@@ -1,5 +1,14 @@
import { convertFileSize } from './index';
export const convertFileToBase64 = (file: File): Promise<string> => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result as string);
reader.onerror = (error) => reject(error);
});
};
export const loadAudioData = async (data: any, type: string) => {
return new Promise((resolve, reject) => {
try {