Merge remote-tracking branch 'origin/feature/0915_素材中心新增手动上传' into test
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
*/
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
|
||||
export function toFixed(num: number | string, n: number): number {
|
||||
return parseFloat(parseFloat(num.toString()).toFixed(n));
|
||||
}
|
||||
@ -111,11 +112,15 @@ export function genRandomId() {
|
||||
return `id_${dayjs().unix()}_${Math.floor(Math.random() * 10000)}`;
|
||||
}
|
||||
|
||||
export function getFileExtension(filename) {
|
||||
const match = filename.match(/\.([^.]+)$/);
|
||||
return match ? match[1].toLowerCase() : '';
|
||||
}
|
||||
export function formatFileSize(bytes: number): string {
|
||||
if (bytes === 0) return '0 Bytes';
|
||||
|
||||
const k = 1024;
|
||||
const sizes = ['Bytes', 'kb', 'mB', 'gB', 'tB'];
|
||||
const sizes = ['Bytes', 'kb', 'mb', 'gb', 'tb'];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
||||
@ -217,7 +222,7 @@ export function getVideoInfo(file: File): Promise<{ duration: number; firstFrame
|
||||
};
|
||||
|
||||
// 设置视频源以触发加载
|
||||
video.src = URL.createObjectURL(file);
|
||||
video.src = window.URL.createObjectURL(file);
|
||||
|
||||
// 设置超时,防止长时间无响应
|
||||
setTimeout(() => {
|
||||
|
||||
@ -42,9 +42,9 @@ export async function initApp() {
|
||||
const enterpriseStore = useEnterpriseStore();
|
||||
|
||||
await userStore.getUserInfo(); // 初始化用户信息
|
||||
await getUserEnterpriseInfo(); // 初始化企业信息
|
||||
|
||||
if (enterpriseStore.isOpenEnterprise) {
|
||||
await getUserEnterpriseInfo(); // 初始化企业信息
|
||||
chatStore.getAgentInfo(); // 初始化智能体信息
|
||||
|
||||
sidebarStore.startUnreadInfoPolling(); // 初始化未读信息
|
||||
|
||||
Reference in New Issue
Block a user