Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
19 changes: 18 additions & 1 deletion frontend/src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
})

Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/chat/ChatListContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ function onChatRenamed(chat: Chat) {
{{ t('qa.new_chat') }}
</el-button>
<el-input
@click.stop
v-model="search"
:prefix-icon="Search"
class="search"
name="quick-search"
autocomplete="off"
:placeholder="t('qa.chat_search')"
clearable
@click.stop
/>
</el-header>
<el-main class="chat-list">
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/views/chat/answer/ChartAnswer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down