Skip to content

Commit

Permalink
config maxToken and defaultTOken
Browse files Browse the repository at this point in the history
  • Loading branch information
swuecho committed Nov 15, 2023
1 parent 60a8fce commit 11b54e3
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions web/src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"enable_per_model_rate_limit": "是否单独流控",
"EnablePerModeRatelimit": "是否单独流控",
"orderNumber": "次序",
"maxToken": "最大token数量",
"defaultToken": "默认token数量"
},
"per_model_rate_limit": {
Expand Down
2 changes: 1 addition & 1 deletion web/src/typings/chat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ declare namespace Chat {
enablePerModeRatelimit: boolean,
maxToken?: number,
defaultToken?: number,
orderNumber?: string,
orderNumber?: number,
httpTimeOut?: number

}
Expand Down
42 changes: 41 additions & 1 deletion web/src/views/admin/model/system_model/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ async function refreshData() {
function UpdateRow(row: Chat.ChatModel) {
if (row.id)
updateChatModel(row.id, { ...row, orderNumber: parseInt(row.orderNumber || '0') })
updateChatModel(row.id, {
...row, orderNumber: parseInt(row.orderNumber || '0'),
defaultToken: parseInt(row.defaultToken || '0'),
maxToken: parseInt(row.maxToken || '0')
})
}
function createColumns(): DataTableColumns<Chat.ChatModel> {
const nameField = {
Expand Down Expand Up @@ -126,6 +130,40 @@ function createColumns(): DataTableColumns<Chat.ChatModel> {
},
}
const defaultToken = {
title: t('admin.chat_model.defaultToken'),
key: 'defaultToken',
width: 100,
render(row: Chat.ChatModel, index: number) {
return h(NInput, {
value: row.defaultToken,
width: 5,
onUpdateValue(v: string) {
// Assuming `data` is an array of FormData objects
data.value[index].defaultToken = v
UpdateRow(data.value[index])
},
})
},
}
const maxToken = {
title: t('admin.chat_model.maxToken'),
key: 'maxToken',
width: 100,
render(row: Chat.ChatModel, index: number) {
return h(NInput, {
value: row.maxToken,
width: 5,
onUpdateValue(v: string) {
// Assuming `data` is an array of FormData objects
data.value[index].maxToken = v
UpdateRow(data.value[index])
},
})
},
}
const isDefaultField = {
title: t('admin.chat_model.isDefault'),
key: 'isDefault',
Expand Down Expand Up @@ -188,6 +226,8 @@ function createColumns(): DataTableColumns<Chat.ChatModel> {
apiAuthHeaderField,
isDefaultField,
perModelLimit,
defaultToken,
maxToken,
orderNumber,
actionField,
])
Expand Down

0 comments on commit 11b54e3

Please sign in to comment.