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: 1 addition & 1 deletion backend/apps/system/api/apikey.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async def grid(session: SessionDep, current_user: CurrentUser) -> list[ApikeyGri
@router.post("")
@system_log(LogConfig(operation_type=OperationType.CREATE, module=OperationModules.API_KEY,result_id_expr='result.self'))
async def create(session: SessionDep, current_user: CurrentUser):
count = session.exec(select(func.count()).select_from(ApiKeyModel)).one()
count = session.exec(select(func.count()).select_from(ApiKeyModel).where(ApiKeyModel.uid == current_user.id)).one()
if count >= 5:
raise ValueError("Maximum of 5 API keys allowed")
access_key = secrets.token_urlsafe(16)
Expand Down
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ explicit = true

[[tool.uv.index]]
name = "default"
url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
url = "https://mirrors.hust.edu.cn/pypi/web/simple"
default = true

[[tool.uv.index]]
Expand Down
32 changes: 29 additions & 3 deletions frontend/src/components/layout/Apikey.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script lang="ts" setup>
import { computed, onMounted, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import SuccessFilled from '@/assets/svg/gou_icon.svg'
import CircleCloseFilled from '@/assets/svg/icon_ban_filled.svg'
import icon_warning_filled from '@/assets/svg/icon_info_colorful.svg'
import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg'
import icon_visible_outlined_blod from '@/assets/embedded/icon_visible_outlined_blod.svg'
Expand Down Expand Up @@ -61,7 +63,7 @@ const copyCode = (row: any, key: any = 'secret_key') => {
})
}
const deleteHandler = (row: any) => {
ElMessageBox.confirm(t('user.del_user', { msg: row.name }), {
ElMessageBox.confirm(t('user.del_key', { msg: row.access_key }), {
confirmButtonType: 'danger',
confirmButtonText: t('dashboard.delete'),
cancelButtonText: t('common.cancel'),
Expand Down Expand Up @@ -146,7 +148,7 @@ onMounted(() => {
style="width: 100%"
@sort-change="sortChange"
>
<el-table-column prop="access_key" label="Access Key" width="256">
<el-table-column prop="access_key" label="Access Key" width="206">
<template #default="scope">
<div class="user-status-container">
<div :title="scope.row.access_key" class="ellipsis" style="max-width: 208px">
Expand All @@ -169,7 +171,7 @@ onMounted(() => {
</div>
</template>
</el-table-column>
<el-table-column prop="secret_key" label="Secret Key" width="256">
<el-table-column prop="secret_key" label="Secret Key" width="206">
<template #default="scope">
<div class="user-status-container">
<div
Expand Down Expand Up @@ -216,6 +218,19 @@ onMounted(() => {
</div>
</template>
</el-table-column>

<el-table-column prop="status" width="100" :label="t('datasource.enabled_status')">
<template #default="scope">
<div class="api-status-container" :class="[scope.row.status ? 'active' : 'disabled']">
<el-icon size="16">
<SuccessFilled v-if="scope.row.status" />
<CircleCloseFilled v-else />
</el-icon>
<span>{{ $t(`user.${scope.row.status ? 'enabled' : 'disabled'}`) }}</span>
</div>
</template>
</el-table-column>

<el-table-column prop="create_time" width="180" sortable :label="t('user.creation_time')">
<template #default="scope">
<span>{{ formatTimestamp(scope.row.create_time, 'YYYY-MM-DD HH:mm:ss') }}</span>
Expand Down Expand Up @@ -334,6 +349,17 @@ onMounted(() => {
}
}
}
.api-status-container {
display: flex;
align-items: center;
font-weight: 400;
font-size: 14px;
line-height: 22px;

.ed-icon {
margin-right: 8px;
}
}
.user-status-container {
display: flex;
align-items: center;
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/layout/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ElMenu } from 'element-plus-secondary'
import { useRoute, useRouter } from 'vue-router'
import MenuItem from './MenuItem.vue'
import { useUserStore } from '@/stores/user'
import { routes } from '@/router'
// import { routes } from '@/router'
const userStore = useUserStore()
const router = useRouter()
defineProps({
Expand Down Expand Up @@ -39,7 +39,9 @@ const formatRoute = (arr: any, parentPath = '') => {

const routerList = computed(() => {
if (showSysmenu.value) {
const [sysRouter] = formatRoute(routes.filter((route) => route.path.includes('/system')))
const [sysRouter] = formatRoute(
router.getRoutes().filter((route: any) => route?.name === 'system')
)
return sysRouter.children
}
const list = router.getRoutes().filter((route) => {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@
"enabled": "Enabled",
"edit_user": "Edit User",
"del_user": "Do you want to delete user: {msg}?",
"del_key": "Do you want to delete key: {msg}?",
"please_first": "Please first",
"download_the_template": "download the template",
"required_and_upload": ", fill in as required and upload",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/i18n/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@
"enabled": "활성화됨",
"edit_user": "사용자 편집",
"del_user": "사용자를 삭제하시겠습니까: {msg}?",
"del_key": "키를 삭제하시겠습니까?: {msg}?",
"please_first": "먼저",
"download_the_template": "템플릿 다운로드",
"required_and_upload": "하여 요구 사항에 따라 작성한 후 업로드하십시오",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@
"enabled": "已启用",
"edit_user": "编辑用户",
"del_user": "是否删除用户: {msg}?",
"del_key": "是否删除key: {msg}?",
"please_first": "请先",
"download_the_template": "下载模板",
"required_and_upload": ",按要求填写后上传",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/chat/QuickQuestion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getRecommendQuestions = () => {

const questions = '[]'
const retrieveQuestions = () => {
getRecommendQuestions()
recommendQuestionRef.value.getRecommendQuestionsLLM(10)
recentQuestionRef.value.getRecentQuestions()
}
const quickAsk = (question: string) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/chat/RecommendQuestionQuick.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ onBeforeUnmount(() => {
stop()
})

defineExpose({ getRecommendQuestions, id: () => props.recordId, stop })
defineExpose({ getRecommendQuestions, id: () => props.recordId, stop, getRecommendQuestionsLLM })
</script>

<template>
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/views/dashboard/components/sq-tab/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const props = defineProps({
type: String,
default: 'canvas-main',
},
disabled: {
type: Boolean,
default: false,
},
})

const { configItem } = toRefs(props)
Expand Down Expand Up @@ -118,7 +122,7 @@ const beforeHandleCommand = (item: any, param: any) => {
param: param,
}
}
const isEditMode = computed(() => props.showPosition === 'canvas')
const isEditMode = computed(() => props.showPosition === 'canvas' && !props.disabled)
const outResizeEnd = () => {
state.tabShow = false
nextTick(() => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/system/audit/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const filterOption = ref<any[]>([
type: 'select',
option: [],
field: 'oid_list',
title: t('audit.operation_user_name'),
title: t('audit.oid_name'),
operate: 'in',
property: { placeholder: t('common.empty') + t('audit.oid_name') },
},
Expand Down
Loading