mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-05-05 09:24:29 +08:00
重构:优化认证逻辑、界面一致性和错误处理
- 移除聊天和音乐接口的冗余认证绕过配置 - 为聊天列表查询添加调试日志记录 - 在即梦和视频模块集成登录弹窗提升用户体验 - 修复模型属性映射问题(category->tag, description->desc) - 移除即梦生成按钮的禁用状态限制 - 简化即梦设置管理页面布局,去除标签页结构 - 清理控制台日志输出并改进错误处理一致性
This commit is contained in:
@@ -49,9 +49,6 @@ var authConfig = &AuthConfig{
|
|||||||
"/api/admin/login": false,
|
"/api/admin/login": false,
|
||||||
"/api/admin/logout": false,
|
"/api/admin/logout": false,
|
||||||
"/api/admin/login/captcha": false,
|
"/api/admin/login/captcha": false,
|
||||||
"/api/chat/history": false,
|
|
||||||
"/api/chat/detail": false,
|
|
||||||
"/api/chat/list": false,
|
|
||||||
"/api/app/list": false,
|
"/api/app/list": false,
|
||||||
"/api/app/type/list": false,
|
"/api/app/type/list": false,
|
||||||
"/api/app/list/user": false,
|
"/api/app/list/user": false,
|
||||||
@@ -66,8 +63,6 @@ var authConfig = &AuthConfig{
|
|||||||
"/api/markMap/client": false,
|
"/api/markMap/client": false,
|
||||||
"/api/payment/doPay": false,
|
"/api/payment/doPay": false,
|
||||||
"/api/payment/payWays": false,
|
"/api/payment/payWays": false,
|
||||||
"/api/suno/detail": false,
|
|
||||||
"/api/suno/play": false,
|
|
||||||
"/api/download": false,
|
"/api/download": false,
|
||||||
"/api/dall/models": false,
|
"/api/dall/models": false,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import (
|
|||||||
|
|
||||||
// List 获取会话列表
|
// List 获取会话列表
|
||||||
func (h *ChatHandler) List(c *gin.Context) {
|
func (h *ChatHandler) List(c *gin.Context) {
|
||||||
|
logger.Info(h.GetLoginUserId(c))
|
||||||
if !h.IsLogin(c) {
|
if !h.IsLogin(c) {
|
||||||
resp.SUCCESS(c)
|
resp.SUCCESS(c)
|
||||||
return
|
return
|
||||||
@@ -28,7 +29,7 @@ func (h *ChatHandler) List(c *gin.Context) {
|
|||||||
userId := h.GetLoginUserId(c)
|
userId := h.GetLoginUserId(c)
|
||||||
var items = make([]vo.ChatItem, 0)
|
var items = make([]vo.ChatItem, 0)
|
||||||
var chats []model.ChatItem
|
var chats []model.ChatItem
|
||||||
h.DB.Where("user_id", userId).Order("id DESC").Find(&chats)
|
h.DB.Debug().Where("user_id", userId).Order("id DESC").Find(&chats)
|
||||||
if len(chats) == 0 {
|
if len(chats) == 0 {
|
||||||
resp.SUCCESS(c, items)
|
resp.SUCCESS(c, items)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
// * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
// * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
import { checkSession } from '@/store/cache'
|
import { checkSession } from '@/store/cache'
|
||||||
|
import { useSharedStore } from '@/store/sharedata'
|
||||||
import { showMessageError, showMessageOK } from '@/utils/dialog'
|
import { showMessageError, showMessageOK } from '@/utils/dialog'
|
||||||
import { httpDownload, httpGet, httpPost } from '@/utils/http'
|
import { httpDownload, httpGet, httpPost } from '@/utils/http'
|
||||||
import { replaceImg, substr } from '@/utils/libs'
|
import { replaceImg, substr } from '@/utils/libs'
|
||||||
@@ -40,6 +41,9 @@ export const useJimengStore = defineStore('jimeng', () => {
|
|||||||
const showDialog = ref(false)
|
const showDialog = ref(false)
|
||||||
const currentVideoUrl = ref('')
|
const currentVideoUrl = ref('')
|
||||||
|
|
||||||
|
// 登录弹窗
|
||||||
|
const shareStore = useSharedStore()
|
||||||
|
|
||||||
// 功能分类配置
|
// 功能分类配置
|
||||||
const categories = [
|
const categories = [
|
||||||
{ key: 'image_generation', name: '图片生成' },
|
{ key: 'image_generation', name: '图片生成' },
|
||||||
@@ -133,7 +137,7 @@ export const useJimengStore = defineStore('jimeng', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const imageEditParams = reactive({
|
const imageEditParams = reactive({
|
||||||
image_urls: [],
|
image_urls: '',
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
seed: -1,
|
seed: -1,
|
||||||
})
|
})
|
||||||
@@ -343,7 +347,7 @@ export const useJimengStore = defineStore('jimeng', () => {
|
|||||||
// 提交任务
|
// 提交任务
|
||||||
const submitTask = async () => {
|
const submitTask = async () => {
|
||||||
if (!isLogin.value) {
|
if (!isLogin.value) {
|
||||||
showMessageError('请先登录')
|
shareStore.setShowLoginDialog(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (userPower.value < currentPowerCost.value) {
|
if (userPower.value < currentPowerCost.value) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import nodata from '@/assets/img/no-data.png'
|
import nodata from '@/assets/img/no-data.png'
|
||||||
import { checkSession, getSystemInfo } from '@/store/cache'
|
import { checkSession, getSystemInfo } from '@/store/cache'
|
||||||
|
import { useSharedStore } from '@/store/sharedata'
|
||||||
import { closeLoading, showLoading, showMessageError, showMessageOK } from '@/utils/dialog'
|
import { closeLoading, showLoading, showMessageError, showMessageOK } from '@/utils/dialog'
|
||||||
import { httpDownload, httpGet, httpPost } from '@/utils/http'
|
import { httpDownload, httpGet, httpPost } from '@/utils/http'
|
||||||
import { replaceImg, substr } from '@/utils/libs'
|
import { replaceImg, substr } from '@/utils/libs'
|
||||||
@@ -37,6 +38,7 @@ export const useVideoStore = defineStore('video', () => {
|
|||||||
// 用户信息
|
// 用户信息
|
||||||
const isLogin = ref(false)
|
const isLogin = ref(false)
|
||||||
const availablePower = ref(100)
|
const availablePower = ref(100)
|
||||||
|
const shareStore = useSharedStore()
|
||||||
|
|
||||||
// 任务筛选
|
// 任务筛选
|
||||||
const taskFilter = ref('all') // 'all', 'luma', 'keling'
|
const taskFilter = ref('all') // 'all', 'luma', 'keling'
|
||||||
@@ -267,6 +269,11 @@ export const useVideoStore = defineStore('video', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const createLumaVideo = async () => {
|
const createLumaVideo = async () => {
|
||||||
|
if (!isLogin.value) {
|
||||||
|
shareStore.setShowLoginDialog(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!lumaParams.prompt?.trim()) {
|
if (!lumaParams.prompt?.trim()) {
|
||||||
return ElMessage.error('请输入视频描述')
|
return ElMessage.error('请输入视频描述')
|
||||||
}
|
}
|
||||||
@@ -365,6 +372,11 @@ export const useVideoStore = defineStore('video', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const createKelingVideo = async () => {
|
const createKelingVideo = async () => {
|
||||||
|
if (!isLogin.value) {
|
||||||
|
shareStore.setShowLoginDialog(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (generating.value) return
|
if (generating.value) return
|
||||||
|
|
||||||
if (!kelingParams.prompt?.trim()) {
|
if (!kelingParams.prompt?.trim()) {
|
||||||
|
|||||||
@@ -219,8 +219,8 @@
|
|||||||
{{ model.power > 0 ? `${model.power}算力` : '免费' }}
|
{{ model.power > 0 ? `${model.power}算力` : '免费' }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div class="model-description" :title="model.description || '暂无描述'">
|
<div class="model-description" :title="model.desc || '暂无描述'">
|
||||||
{{ model.description || '暂无描述' }}
|
{{ model.desc || '暂无描述' }}
|
||||||
</div>
|
</div>
|
||||||
<!-- 暂时屏蔽此信息展示,或许用户不想展示此信息 -->
|
<!-- 暂时屏蔽此信息展示,或许用户不想展示此信息 -->
|
||||||
<div class="model-metadata">
|
<div class="model-metadata">
|
||||||
@@ -488,7 +488,7 @@ const filteredModels = computed(() => {
|
|||||||
model.description.toLowerCase().includes(modelSearchKeyword.value.toLowerCase()))
|
model.description.toLowerCase().includes(modelSearchKeyword.value.toLowerCase()))
|
||||||
|
|
||||||
// 分类匹配
|
// 分类匹配
|
||||||
const matchesCategory = !activeCategory.value || model.category === activeCategory.value
|
const matchesCategory = !activeCategory.value || model.tag === activeCategory.value
|
||||||
|
|
||||||
// 免费模型匹配
|
// 免费模型匹配
|
||||||
const matchesFree = !showFreeModelsOnly.value || model.power <= 0
|
const matchesFree = !showFreeModelsOnly.value || model.power <= 0
|
||||||
@@ -514,8 +514,8 @@ const toggleFreeModels = () => {
|
|||||||
const updateModelCategories = () => {
|
const updateModelCategories = () => {
|
||||||
const categories = new Set()
|
const categories = new Set()
|
||||||
models.value.forEach((model) => {
|
models.value.forEach((model) => {
|
||||||
if (model.category) {
|
if (model.tag) {
|
||||||
categories.add(model.category)
|
categories.add(model.tag)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
modelCategories.value = Array.from(categories)
|
modelCategories.value = Array.from(categories)
|
||||||
@@ -539,7 +539,7 @@ const updateGroupedModels = () => {
|
|||||||
// 否则按分类分组展示
|
// 否则按分类分组展示
|
||||||
const groups = {}
|
const groups = {}
|
||||||
filtered.forEach((model) => {
|
filtered.forEach((model) => {
|
||||||
const category = model.category || '未分类'
|
const category = model.tag || '未分类'
|
||||||
if (!groups[category]) {
|
if (!groups[category]) {
|
||||||
groups[category] = []
|
groups[category] = []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,7 +214,6 @@ watch(
|
|||||||
// 监听路由变化;
|
// 监听路由变化;
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
curPath.value = to.path
|
curPath.value = to.path
|
||||||
console.log(curPath.value)
|
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -282,7 +282,6 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
@click="store.submitTask"
|
@click="store.submitTask"
|
||||||
:loading="store.submitting"
|
:loading="store.submitting"
|
||||||
:disabled="!store.isLogin || store.userPower < store.currentPowerCost"
|
|
||||||
size="large"
|
size="large"
|
||||||
>
|
>
|
||||||
立即生成 ({{ store.currentPowerCost }}<i class="iconfont icon-vip2"></i>)
|
立即生成 ({{ store.currentPowerCost }}<i class="iconfont icon-vip2"></i>)
|
||||||
|
|||||||
@@ -7,174 +7,163 @@
|
|||||||
label-position="right"
|
label-position="right"
|
||||||
ref="configFormRef"
|
ref="configFormRef"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
|
class="py-3 px-5"
|
||||||
>
|
>
|
||||||
<el-tabs type="border-card">
|
<!-- 秘钥配置分组 -->
|
||||||
<el-tab-pane>
|
<div class="mb-3">
|
||||||
|
<h3 class="mb-2">秘钥配置</h3>
|
||||||
|
<el-form-item label="AccessKey" prop="access_key">
|
||||||
|
<el-input
|
||||||
|
v-model="jimengConfig.access_key"
|
||||||
|
placeholder="请输入即梦AI的AccessKey"
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="SecretKey" prop="secret_key">
|
||||||
|
<el-input
|
||||||
|
v-model="jimengConfig.secret_key"
|
||||||
|
placeholder="请输入即梦AI的SecretKey"
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<el-divider />
|
||||||
|
<!-- 算力配置分组 -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<h3 class="mb-3">算力配置</h3>
|
||||||
|
<el-form-item>
|
||||||
<template #label>
|
<template #label>
|
||||||
<i class="iconfont icon-token mr-1"></i>
|
<div class="label-title">
|
||||||
<span>秘钥配置</span>
|
文生图算力
|
||||||
|
<el-tooltip
|
||||||
|
effect="dark"
|
||||||
|
content="用户使用文生图功能时消耗的算力"
|
||||||
|
raw-content
|
||||||
|
placement="right"
|
||||||
|
>
|
||||||
|
<el-icon>
|
||||||
|
<InfoFilled />
|
||||||
|
</el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-form-item label="AccessKey" prop="access_key">
|
<el-input-number
|
||||||
<el-input
|
v-model="jimengConfig.power.text_to_image"
|
||||||
v-model="jimengConfig.access_key"
|
:min="1"
|
||||||
placeholder="请输入即梦AI的AccessKey"
|
placeholder="请输入文生图算力消耗"
|
||||||
show-password
|
/>
|
||||||
/>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item>
|
||||||
<el-form-item label="SecretKey" prop="secret_key">
|
|
||||||
<el-input
|
|
||||||
v-model="jimengConfig.secret_key"
|
|
||||||
placeholder="请输入即梦AI的SecretKey"
|
|
||||||
show-password
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-tab-pane>
|
|
||||||
|
|
||||||
<el-tab-pane>
|
|
||||||
<template #label>
|
<template #label>
|
||||||
<i class="iconfont icon-logout mr-1"></i>
|
<div class="label-title">
|
||||||
<span>算力配置</span>
|
图生图算力
|
||||||
|
<el-tooltip
|
||||||
|
effect="dark"
|
||||||
|
content="用户使用图生图功能时消耗的算力"
|
||||||
|
raw-content
|
||||||
|
placement="right"
|
||||||
|
>
|
||||||
|
<el-icon>
|
||||||
|
<InfoFilled />
|
||||||
|
</el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-form-item>
|
<el-input-number
|
||||||
<template #label>
|
v-model="jimengConfig.power.image_to_image"
|
||||||
<div class="label-title">
|
:min="1"
|
||||||
文生图算力
|
placeholder="请输入图生图算力消耗"
|
||||||
<el-tooltip
|
/>
|
||||||
effect="dark"
|
</el-form-item>
|
||||||
content="用户使用文生图功能时消耗的算力"
|
<el-form-item>
|
||||||
raw-content
|
<template #label>
|
||||||
placement="right"
|
<div class="label-title">
|
||||||
>
|
图片编辑算力
|
||||||
<el-icon>
|
<el-tooltip
|
||||||
<InfoFilled />
|
effect="dark"
|
||||||
</el-icon>
|
content="用户使用图片编辑功能时消耗的算力"
|
||||||
</el-tooltip>
|
raw-content
|
||||||
</div>
|
placement="right"
|
||||||
</template>
|
>
|
||||||
<el-input-number
|
<el-icon>
|
||||||
v-model="jimengConfig.power.text_to_image"
|
<InfoFilled />
|
||||||
:min="1"
|
</el-icon>
|
||||||
placeholder="请输入文生图算力消耗"
|
</el-tooltip>
|
||||||
/>
|
</div>
|
||||||
</el-form-item>
|
</template>
|
||||||
|
<el-input-number
|
||||||
<el-form-item>
|
v-model="jimengConfig.power.image_edit"
|
||||||
<template #label>
|
:min="1"
|
||||||
<div class="label-title">
|
placeholder="请输入图片编辑算力消耗"
|
||||||
图生图算力
|
/>
|
||||||
<el-tooltip
|
</el-form-item>
|
||||||
effect="dark"
|
<el-form-item>
|
||||||
content="用户使用图生图功能时消耗的算力"
|
<template #label>
|
||||||
raw-content
|
<div class="label-title">
|
||||||
placement="right"
|
图片特效算力
|
||||||
>
|
<el-tooltip
|
||||||
<el-icon>
|
effect="dark"
|
||||||
<InfoFilled />
|
content="用户使用图片特效功能时消耗的算力"
|
||||||
</el-icon>
|
raw-content
|
||||||
</el-tooltip>
|
placement="right"
|
||||||
</div>
|
>
|
||||||
</template>
|
<el-icon>
|
||||||
<el-input-number
|
<InfoFilled />
|
||||||
v-model="jimengConfig.power.image_to_image"
|
</el-icon>
|
||||||
:min="1"
|
</el-tooltip>
|
||||||
placeholder="请输入图生图算力消耗"
|
</div>
|
||||||
/>
|
</template>
|
||||||
</el-form-item>
|
<el-input-number
|
||||||
|
v-model="jimengConfig.power.image_effects"
|
||||||
<el-form-item>
|
:min="1"
|
||||||
<template #label>
|
placeholder="请输入图片特效算力消耗"
|
||||||
<div class="label-title">
|
/>
|
||||||
图片编辑算力
|
</el-form-item>
|
||||||
<el-tooltip
|
<el-form-item>
|
||||||
effect="dark"
|
<template #label>
|
||||||
content="用户使用图片编辑功能时消耗的算力"
|
<div class="label-title">
|
||||||
raw-content
|
文生视频算力
|
||||||
placement="right"
|
<el-tooltip
|
||||||
>
|
effect="dark"
|
||||||
<el-icon>
|
content="用户使用文生视频功能时消耗的算力"
|
||||||
<InfoFilled />
|
raw-content
|
||||||
</el-icon>
|
placement="right"
|
||||||
</el-tooltip>
|
>
|
||||||
</div>
|
<el-icon>
|
||||||
</template>
|
<InfoFilled />
|
||||||
<el-input-number
|
</el-icon>
|
||||||
v-model="jimengConfig.power.image_edit"
|
</el-tooltip>
|
||||||
:min="1"
|
</div>
|
||||||
placeholder="请输入图片编辑算力消耗"
|
</template>
|
||||||
/>
|
<el-input-number
|
||||||
</el-form-item>
|
v-model="jimengConfig.power.text_to_video"
|
||||||
|
:min="1"
|
||||||
<el-form-item>
|
placeholder="请输入文生视频算力消耗"
|
||||||
<template #label>
|
/>
|
||||||
<div class="label-title">
|
</el-form-item>
|
||||||
图片特效算力
|
<el-form-item>
|
||||||
<el-tooltip
|
<template #label>
|
||||||
effect="dark"
|
<div class="label-title">
|
||||||
content="用户使用图片特效功能时消耗的算力"
|
图生视频算力
|
||||||
raw-content
|
<el-tooltip
|
||||||
placement="right"
|
effect="dark"
|
||||||
>
|
content="用户使用图生视频功能时消耗的算力"
|
||||||
<el-icon>
|
raw-content
|
||||||
<InfoFilled />
|
placement="right"
|
||||||
</el-icon>
|
>
|
||||||
</el-tooltip>
|
<el-icon>
|
||||||
</div>
|
<InfoFilled />
|
||||||
</template>
|
</el-icon>
|
||||||
<el-input-number
|
</el-tooltip>
|
||||||
v-model="jimengConfig.power.image_effects"
|
</div>
|
||||||
:min="1"
|
</template>
|
||||||
placeholder="请输入图片特效算力消耗"
|
<el-input-number
|
||||||
/>
|
v-model="jimengConfig.power.image_to_video"
|
||||||
</el-form-item>
|
:min="1"
|
||||||
|
placeholder="请输入图生视频算力消耗"
|
||||||
<el-form-item>
|
/>
|
||||||
<template #label>
|
</el-form-item>
|
||||||
<div class="label-title">
|
</div>
|
||||||
文生视频算力
|
|
||||||
<el-tooltip
|
|
||||||
effect="dark"
|
|
||||||
content="用户使用文生视频功能时消耗的算力"
|
|
||||||
raw-content
|
|
||||||
placement="right"
|
|
||||||
>
|
|
||||||
<el-icon>
|
|
||||||
<InfoFilled />
|
|
||||||
</el-icon>
|
|
||||||
</el-tooltip>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<el-input-number
|
|
||||||
v-model="jimengConfig.power.text_to_video"
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入文生视频算力消耗"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item>
|
|
||||||
<template #label>
|
|
||||||
<div class="label-title">
|
|
||||||
图生视频算力
|
|
||||||
<el-tooltip
|
|
||||||
effect="dark"
|
|
||||||
content="用户使用图生视频功能时消耗的算力"
|
|
||||||
raw-content
|
|
||||||
placement="right"
|
|
||||||
>
|
|
||||||
<el-icon>
|
|
||||||
<InfoFilled />
|
|
||||||
</el-icon>
|
|
||||||
</el-tooltip>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<el-input-number
|
|
||||||
v-model="jimengConfig.power.image_to_video"
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入图生视频算力消耗"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
|
|
||||||
<div style="padding: 10px">
|
<div style="padding: 10px">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="saveConfig" :loading="saving">保存配置</el-button>
|
<el-button type="primary" @click="saveConfig" :loading="saving">保存配置</el-button>
|
||||||
@@ -240,7 +229,9 @@ const saveConfig = async () => {
|
|||||||
await httpPost('/api/admin/jimeng/config/update', jimengConfig.value)
|
await httpPost('/api/admin/jimeng/config/update', jimengConfig.value)
|
||||||
ElMessage.success('配置保存成功!')
|
ElMessage.success('配置保存成功!')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ElMessage.error(e.message)
|
if (e.message) {
|
||||||
|
ElMessage.error(e.message)
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false
|
saving.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user