@blocklet/pages-kit 0.2.421 → 0.2.423
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/builtin/async/ai-runtime/api/asset.js +4 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +2 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/api/asset.js +4 -2
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +2 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/async/ai-runtime/api/asset.d.ts +3 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -2,9 +2,10 @@ import { joinURL, withQuery } from 'ufo';
|
|
|
2
2
|
import { getAIRuntimeApiPrefix } from './request';
|
|
3
3
|
const presets = {
|
|
4
4
|
avatar: { w: 80 },
|
|
5
|
+
default: { w: 1200 },
|
|
5
6
|
};
|
|
6
7
|
export function getAssetUrl({ blockletDid, aid, filename, w, preset, }) {
|
|
7
|
-
var _a;
|
|
8
|
+
var _a, _b;
|
|
8
9
|
const url = filename && aid && !(filename === null || filename === void 0 ? void 0 : filename.startsWith('http'))
|
|
9
10
|
? withQuery(joinURL(getAIRuntimeApiPrefix(), '/api/agents', aid, 'assets', filename), {
|
|
10
11
|
blockletDid,
|
|
@@ -12,9 +13,10 @@ export function getAssetUrl({ blockletDid, aid, filename, w, preset, }) {
|
|
|
12
13
|
: filename;
|
|
13
14
|
if (!url)
|
|
14
15
|
return url;
|
|
15
|
-
const width = w !== null && w !== void 0 ? w : (_a = presets[preset]) === null || _a === void 0 ? void 0 : _a.w;
|
|
16
|
+
const width = (_b = w !== null && w !== void 0 ? w : (_a = presets[preset]) === null || _a === void 0 ? void 0 : _a.w) !== null && _b !== void 0 ? _b : presets.default.w;
|
|
16
17
|
return withQuery(url, {
|
|
17
18
|
imageFilter: width ? 'resize' : undefined,
|
|
19
|
+
f: 'webp',
|
|
18
20
|
w: width,
|
|
19
21
|
});
|
|
20
22
|
}
|
|
@@ -14,6 +14,7 @@ import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
|
|
|
14
14
|
import { Icon } from '@iconify/react';
|
|
15
15
|
import { Box, Button, Dialog, DialogContent, DialogTitle, Stack, Typography, alpha } from '@mui/material';
|
|
16
16
|
import { useMemo, useState } from 'react';
|
|
17
|
+
import { withQuery } from 'ufo';
|
|
17
18
|
import { RelativeTime } from '../../../../arcblock/ux';
|
|
18
19
|
import { useLocaleContext } from '../../../../locale';
|
|
19
20
|
import { useSessionContext } from '../../../../session';
|
|
@@ -51,7 +52,7 @@ export default function PhotoGalleryItem() {
|
|
|
51
52
|
opacity: 1,
|
|
52
53
|
},
|
|
53
54
|
},
|
|
54
|
-
}, onClick: () => setOpenDialog(true), children: [_jsx(Box, { component: "img", src: url, alt: "", width: "100%", height: "100%",
|
|
55
|
+
}, onClick: () => setOpenDialog(true), children: [_jsx(Box, { component: "img", src: withQuery(url, { imageFilter: 'resize', w: 500 }), alt: "", width: "100%", height: "100%",
|
|
55
56
|
// 首屏 image 不能用 lazy,会闪烁乱序
|
|
56
57
|
loading: index < 12 ? 'eager' : 'lazy' }), _jsx(Box, { className: "photo-wall-item-alt", sx: {
|
|
57
58
|
position: 'absolute',
|