diff --git a/frontend/package.json b/frontend/package.json
index 50e4dbce..51c4b595 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -30,6 +30,7 @@
"github-markdown-css": "^5.8.1",
"highlight.js": "^11.11.1",
"html2canvas": "^1.4.1",
+ "json-bigint": "^1.0.0",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"markdown-it": "^14.1.0",
@@ -47,6 +48,7 @@
"@eslint/migrate-config": "^1.5.0",
"@types/crypto-js": "^4.2.2",
"@types/element-resize-detector": "^1.1.6",
+ "@types/json-bigint": "^1.0.4",
"@types/markdown-it": "^14.1.2",
"@types/node": "^22.14.1",
"@typescript-eslint/eslint-plugin": "^8.34.0",
diff --git a/frontend/src/utils/request.ts b/frontend/src/utils/request.ts
index ca366dfc..84db2335 100644
--- a/frontend/src/utils/request.ts
+++ b/frontend/src/utils/request.ts
@@ -12,6 +12,7 @@ import { useCache } from '@/utils/useCache'
import { getLocale } from './utils'
import { useAssistantStore } from '@/stores/assistant'
import { useRouter } from 'vue-router'
+import JSONBig from 'json-bigint'
// import { i18n } from '@/i18n'
// const t = i18n.global.t
const assistantStore = useAssistantStore()
@@ -61,6 +62,22 @@ class HttpService {
'Content-Type': 'application/json',
...config?.headers,
},
+ // add transformResponse to bigint
+ transformResponse: [
+ function (data) {
+ try {
+ return JSONBig.parse(data) // use JSON-bigint
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ } catch (e) {
+ try {
+ return JSON.parse(data)
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ } catch (parseError) {
+ return data
+ }
+ }
+ },
+ ],
...config,
})
@@ -442,7 +459,7 @@ class HttpService {
export const request = new HttpService({
baseURL: import.meta.env.VITE_API_BASE_URL,
})
-/*
+/*
const showLicenseKeyError = (msg?: string) => {
ElMessageBox.confirm(t('license.error_tips'), {
confirmButtonType: 'primary',
diff --git a/frontend/src/views/chat/ChatListContainer.vue b/frontend/src/views/chat/ChatListContainer.vue
index 9e3e6455..3a154b2b 100644
--- a/frontend/src/views/chat/ChatListContainer.vue
+++ b/frontend/src/views/chat/ChatListContainer.vue
@@ -230,7 +230,6 @@ function onChatRenamed(chat: Chat) {
{{ t('qa.new_chat') }}
diff --git a/frontend/src/views/chat/answer/ChartAnswer.vue b/frontend/src/views/chat/answer/ChartAnswer.vue
index 14ed3a78..1f1f4504 100644
--- a/frontend/src/views/chat/answer/ChartAnswer.vue
+++ b/frontend/src/views/chat/answer/ChartAnswer.vue
@@ -3,6 +3,7 @@ import BaseAnswer from './BaseAnswer.vue'
import { Chat, chatApi, ChatInfo, type ChatMessage, ChatRecord, questionApi } from '@/api/chat.ts'
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
import ChartBlock from '@/views/chat/chat-block/ChartBlock.vue'
+import JSONBig from 'json-bigint'
const props = withDefaults(
defineProps<{
@@ -141,7 +142,7 @@ const sendMessage = async () => {
for (const str of split) {
let data
try {
- data = JSON.parse(str.replace('data:{', '{'))
+ data = JSONBig.parse(str.replace('data:{', '{'))
} catch (err) {
console.error('JSON string:', str)
throw err
@@ -198,7 +199,6 @@ const sendMessage = async () => {
if (!_currentChat.value.datasource) {
_currentChat.value.datasource = data.id
}
- _currentChat.value.records[index.value].chart = data.content
break
case 'finish':
emits('finish', currentRecord.id)