Skip to content

Commit 05b8129

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/pay
2 parents 37c46db + e49a162 commit 05b8129

Some content is hidden

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

57 files changed

+1792
-445
lines changed

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ VITE_API_PATH=http://127.0.0.1:8000
77

88
# WebSocket Configuration
99
# Set to 'true' to use WebSocket instead of Server-Sent Events (SSE)
10-
# Default: false (uses SSE)
11-
VITE_USE_WEBSOCKET=false
10+
# Default: true (uses WebSocket)
11+
VITE_USE_WEBSOCKET=true

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"i18next": "^25.6.0",
4747
"i18next-browser-languagedetector": "^8.2.0",
4848
"ismobilejs": "^1.1.1",
49+
"jszip": "^3.10.1",
4950
"katex": "^0.16.25",
5051
"lodash-es": "^4.17.21",
5152
"lucide-react": "^0.468.0",

pnpm-lock.yaml

Lines changed: 75 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/attributes/index.tsx

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Button } from '@/components/button';
88
import ResourceTasks from '@/components/resource-tasks';
99
import Tag from '@/components/tags';
1010
import { Resource } from '@/interface';
11-
import { http } from '@/lib/request';
11+
import { downloadFile } from '@/lib/download-file';
1212

1313
interface IProps {
1414
resource: Resource;
@@ -82,7 +82,7 @@ export default function Attributes(props: IProps) {
8282
);
8383
}
8484

85-
if (resource.attrs && resource.attrs.url && resource.attrs.original_name) {
85+
if (resource.resource_type === 'file' && resource.attrs?.original_name) {
8686
return (
8787
<div className="space-y-2 mt-2 mb-6 text-base">
8888
<Tag
@@ -101,30 +101,13 @@ export default function Attributes(props: IProps) {
101101
className="text-base font-normal ml-[-16px]"
102102
onClick={() => {
103103
onDownload(true);
104-
http
105-
.get(
106-
`/namespaces/${namespaceId}/resources/files/${resource.id}`,
107-
{
108-
responseType: 'blob',
109-
}
110-
)
111-
.then(blob => {
112-
const link = document.createElement('a');
113-
const url = window.URL.createObjectURL(blob);
114-
link.href = url;
115-
link.target = '_blank';
116-
if (resource.attrs && resource.attrs.original_name) {
117-
link.download = decodeURI(resource.attrs.original_name);
118-
}
119-
link.style.display = 'none';
120-
document.body.appendChild(link);
121-
link.click();
122-
link.remove();
123-
window.URL.revokeObjectURL(url);
124-
})
125-
.finally(() => {
126-
onDownload(false);
127-
});
104+
downloadFile(
105+
namespaceId,
106+
resource.id,
107+
resource.attrs?.original_name
108+
).finally(() => {
109+
onDownload(false);
110+
});
128111
}}
129112
>
130113
{resource.attrs.original_name}

src/components/copy/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default function CopyMain(props: IProps) {
5050
)}
5151
</TooltipTrigger>
5252
<TooltipContent>
53-
<p>{t('copy.title')}</p>
53+
<p>{t('chat.messages.actions.copy')}</p>
5454
</TooltipContent>
5555
</Tooltip>
5656
);

0 commit comments

Comments
 (0)