Skip to content

Commit 2735344

Browse files
author
teable-bot
committed
[sync] fix: ai chat UI style detail T1725 T1723 (#1074)
Synced from teableio/teable-ee@8adf65d
1 parent 4ceb811 commit 2735344

File tree

49 files changed

+568
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+568
-129
lines changed

apps/nestjs-backend/src/features/attachments/attachments-storage.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ export class AttachmentsStorageService {
8282
expiresIn: number = this.urlExpireIn,
8383
respHeaders?: IRespHeaders
8484
) {
85+
// Use 50% of URL expiration time for cache TTL to ensure URLs are refreshed
86+
// before they expire, preventing stale URLs after deployments
87+
const cacheTtl = Math.floor(expiresIn * 0.5);
8588
const previewCache = await this.cacheService.get(`attachment:preview:${token}`);
8689
let url = previewCache?.url;
8790
if (!url) {
@@ -92,7 +95,7 @@ export class AttachmentsStorageService {
9295
url,
9396
expiresIn,
9497
},
95-
expiresIn
98+
cacheTtl
9699
);
97100
}
98101
return url;

apps/nestjs-backend/src/features/attachments/plugins/local.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,15 +333,15 @@ describe('LocalStorage', () => {
333333
});
334334
});
335335

336-
describe('getPreviewUrlInner', () => {
336+
describe('getPreviewUrl', () => {
337337
it('should get preview URL', async () => {
338338
const mockBucket = 'mock-bucket';
339339
const mockPath = 'mock/file/path';
340340
const mockExpiresIn = 3600;
341341

342342
vi.spyOn(storage.expireTokenEncryptor, 'encrypt').mockReturnValueOnce('mock-token');
343343

344-
const result = await storage.getPreviewUrlInner(
344+
const result = await storage.getPreviewUrl(
345345
mockBucket,
346346
mockPath,
347347
mockExpiresIn,

apps/nestjs-backend/src/features/attachments/plugins/local.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,6 @@ export class LocalStorage implements StorageAdapter {
257257
expiresIn: number = second(this.config.urlExpireIn),
258258
respHeaders?: IRespHeaders
259259
): Promise<string> {
260-
return this.getPreviewUrlInner(bucket, path, expiresIn, respHeaders);
261-
}
262-
263-
async getPreviewUrlInner(
264-
bucket: string,
265-
path: string,
266-
expiresIn: number,
267-
respHeaders?: IRespHeaders
268-
) {
269260
const url = this.getUrl(bucket, path, {
270261
expiresDate: Math.floor(Date.now() / 1000) + expiresIn,
271262
respHeaders,

apps/nestjs-backend/src/features/attachments/plugins/utils.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { baseConfig } from '../../../configs/base.config';
33
import { storageConfig } from '../../../configs/storage';
44
import type { ThumbnailSize } from './types';
55

6+
/**
7+
* public bucket storage url path
8+
*/
69
export const getPublicFullStorageUrl = (path: string) => {
710
const { storagePrefix } = baseConfig();
811
const { provider, publicUrl, publicBucket } = storageConfig();
@@ -16,3 +19,16 @@ export const getPublicFullStorageUrl = (path: string) => {
1619
export const generateCropImagePath = (path: string, size: ThumbnailSize) => {
1720
return `${path}_${size}`;
1821
};
22+
23+
/**
24+
* resolve storage url to full url
25+
*/
26+
export const resolveStorageUrl = (url: string) => {
27+
const { storagePrefix } = baseConfig();
28+
const { provider } = storageConfig();
29+
if (provider === 'local' && storagePrefix) {
30+
return new URL(url, storagePrefix).toString();
31+
}
32+
33+
return url;
34+
};

apps/nestjs-backend/src/types/i18n.generated.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,10 +3298,14 @@ export type I18nTranslations = {
32983298
"baseList": {
32993299
"allBases": string;
33003300
"owner": string;
3301+
"createdTime": string;
33013302
"lastOpened": string;
33023303
"enter": string;
33033304
"noTables": string;
33043305
"empty": string;
3306+
"recent": string;
3307+
"manual": string;
3308+
"noBasesFound": string;
33053309
};
33063310
"publishBase": {
33073311
"title": string;
@@ -4458,6 +4462,7 @@ export type I18nTranslations = {
44584462
"generateScriptAndDependencies": string;
44594463
"analyzingAttachment": string;
44604464
"locateResource": string;
4465+
"goTo": string;
44614466
"operationSuccess": string;
44624467
"operationFailed": string;
44634468
};
@@ -4594,6 +4599,9 @@ export type I18nTranslations = {
45944599
"waitedSeconds": string;
45954600
"waitFailed": string;
45964601
};
4602+
"expand": string;
4603+
"history": string;
4604+
"close": string;
45974605
"dataVisualization": {
45984606
"error": string;
45994607
};

apps/nextjs-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"devDependencies": {
4747
"@next/bundle-analyzer": "16.1.1",
4848
"@next/env": "16.1.1",
49-
"@playwright/test": "1.42.1",
49+
"@playwright/test": "1.57.0",
5050
"@size-limit/file": "11.1.2",
5151
"@svgr/webpack": "8.1.0",
5252
"@testing-library/dom": "9.3.4",

apps/nextjs-app/src/features/app/blocks/admin/setting/components/ai-config/AIConfigurationStatus.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ export const AIConfigurationStatus = ({ aiConfig, onNavigate }: IAIConfiguration
140140
</h3>
141141
<div
142142
className={cn(
143-
'rounded-full px-2 py-0.5 text-xs font-medium',
143+
'rounded-full px-2 py-0.5 text-xs',
144144
allComplete && !hasWarning
145-
? 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400'
145+
? 'bg-emerald-100 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-500'
146146
: hasWarning
147147
? 'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400'
148148
: 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400'

apps/nextjs-app/src/features/app/blocks/admin/setting/components/ai-config/CodingModels.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ export const CodingModels = ({
193193
const badge = (
194194
<div
195195
className={cn(
196-
'flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium transition-colors',
196+
'flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs transition-colors',
197197
supported
198-
? 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400'
198+
? 'bg-emerald-100 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-500'
199199
: 'bg-muted text-muted-foreground'
200200
)}
201201
>

apps/nextjs-app/src/features/app/blocks/admin/setting/components/ai-config/LlmproviderManage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,9 @@ const ModelRow = ({
378378
<div
379379
key={abilityType}
380380
className={cn(
381-
'flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium transition-colors',
381+
'flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] transition-colors',
382382
tested && supported
383-
? 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400'
383+
? 'bg-emerald-100 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-500'
384384
: 'bg-muted text-muted-foreground'
385385
)}
386386
>
@@ -399,9 +399,9 @@ const ModelRow = ({
399399
const badge = (
400400
<div
401401
className={cn(
402-
'flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium transition-colors',
402+
'flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] transition-colors',
403403
tested && supported
404-
? 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400'
404+
? 'bg-emerald-100 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-500'
405405
: 'bg-muted text-muted-foreground'
406406
)}
407407
>

apps/nextjs-app/src/features/app/blocks/space-setting/SpaceInnerSettingModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface ISpaceInnerSettingModalProps {
2424
export enum SettingTab {
2525
General = 'general',
2626
Collaborator = 'collaborator',
27+
Plan = 'plan',
2728
}
2829

2930
export const SpaceInnerSettingModal = (props: ISpaceInnerSettingModalProps) => {

0 commit comments

Comments
 (0)