fix: 隐藏文件上传按钮,去除不必要的log打印

This commit is contained in:
Gsh
2025-07-07 23:27:55 +08:00
parent c9b79a074b
commit 4fc6a1e818
19 changed files with 55 additions and 71 deletions

View File

@@ -3,7 +3,6 @@ import { get, post } from '@/utils/request';
// 发送消息
export const send = (data: SendDTO) => post<null>('/ai-chat/send', data);
// export const send = (data: SendDTO) => post<null>('/chat/send', data);
// 新增对应会话聊天记录
export function addChat(data: ChatMessageVo) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@@ -35,7 +35,6 @@ const { reset, open, onChange } = useFileDialog({
onChange((files) => {
if (!files)
return;
console.log('files', files);
const arr = [] as FilesList[];
for (let i = 0; i < files!.length; i++) {
const file = files![i];

View File

@@ -8,7 +8,6 @@ const { copy } = useClipboard();
const name = ref('');
const iconList = ref(icons);
console.log(icons);
function filterIcons() {
iconList.value = JSON.parse(JSON.stringify(icons));

View File

@@ -30,7 +30,6 @@ async function handleSubmit() {
try {
await formRef.value?.validate();
const res = await login(formModel);
console.log(res, 'res');
res.data.token && userStore.setToken(res.data.token);
res.data.userInfo && userStore.setUserInfo(res.data.userInfo);
ElMessage.success('登录成功');

View File

@@ -57,9 +57,7 @@ async function checkConfirmStatus() {
// 模拟登录逻辑 如果在客户端已确认,则会调用这个方法进行登录
async function mockLogin() {
// 模拟登录成功逻辑
console.log('模拟调用登录接口...');
await new Promise(resolve => setTimeout(resolve, 500));
console.log('模拟调用登录成功...');
}
/** 停止所有轮询 */

View File

@@ -56,8 +56,6 @@ function onAfterLeave() {
}
function handleThirdPartyLogin() {
console.log('SSO_SEVER_URL', SSO_SEVER_URL);
console.log('import.meta.env', import.meta.env);
const redirectUri = encodeURIComponent(`${window.location.origin}/chat`);
const popup = window.open(
`${SSO_SEVER_URL}/login?client_id=${SSO_CLIENT_ID}&redirect_uri=${redirectUri}`,

View File

@@ -100,7 +100,6 @@ function handleModelClick(item: GetSessionListVO) {
});
}
console.log('handleClick--', item);
modelStore.setCurrentModelInfo(item);
popoverRef.value?.hide?.();
}

View File

@@ -34,11 +34,9 @@ export function useWindowWidthObserver(
designStore.setCollapse(false);
if (isAbove) {
// 大于的时候执行关闭动画 (豆包是有的,第一版本暂未添加)
console.log('执行关闭动画');
}
else {
// 小于的时候执行打开动画 (豆包是有的,第一版本暂未添加)
console.log('小于的时候执行打开动画');
}
break;
case 'narrowExpandWideCollapse':

View File

@@ -5,6 +5,7 @@ import Popover from '@/components/Popover/index.vue';
import SvgIcon from '@/components/SvgIcon/index.vue';
import { useUserStore } from '@/stores';
import { useSessionStore } from '@/stores/modules/session';
import { userProfilePicture } from '@/utils/user';
const router = useRouter();
@@ -82,14 +83,11 @@ function handleClick(item: any) {
switch (item.key) {
case '1':
ElMessage.warning('暂未开放');
console.log('点击了收藏夹');
break;
case '2':
ElMessage.warning('暂未开放');
console.log('点击了设置');
break;
case '5':
console.log('点击了用户中心');
openDialog();
break;
case '4':
@@ -207,13 +205,13 @@ function openVipGuide() {
:popover-style="popoverStyle"
>
<template #trigger>
<el-avatar :src="src" :size="28" fit="fit" shape="circle" />
<el-avatar :src="userProfilePicture" :size="28" fit="fit" shape="circle" />
</template>
<div class="popover-content-box shadow-lg">
<!-- 用户信息 -->
<div class="user-info-box flex items-center gap-8px p-8px rounded-lg mb-2">
<el-avatar :src="src" :size="32" fit="fit" shape="circle" />
<el-avatar :src="userProfilePicture" :size="32" fit="fit" shape="circle" />
<div class="flex flex-col text-sm">
<div class="font-semibold text-gray-800">
{{ userStore.userInfo?.user.nick ?? '未登录用户' }}

View File

@@ -1,7 +1,6 @@
<!-- 默认消息列表页 -->
<script setup lang="ts">
import type { FilesCardProps } from 'vue-element-plus-x/types/FilesCard';
import FilesSelect from '@/components/FilesSelect/index.vue';
import ModelSelect from '@/components/ModelSelect/index.vue';
import WelecomeText from '@/components/WelecomeText/index.vue';
import { useUserStore } from '@/stores';
@@ -97,7 +96,7 @@ watch(
</template>
<template #prefix>
<div class="flex-1 flex items-center gap-8px flex-none w-fit overflow-hidden">
<FilesSelect />
<!-- <FilesSelect /> -->
<ModelSelect />
</div>
</template>

View File

@@ -6,17 +6,18 @@ import type { BubbleProps } from 'vue-element-plus-x/types/Bubble';
import type { BubbleListInstance } from 'vue-element-plus-x/types/BubbleList';
import type { FilesCardProps } from 'vue-element-plus-x/types/FilesCard';
import type { ThinkingStatus } from 'vue-element-plus-x/types/Thinking';
import { ElMessage } from 'element-plus';
import { ArrowLeftBold, ArrowRightBold } from '@element-plus/icons-vue';
import { ElIcon, ElMessage } from 'element-plus';
import { useHookFetch } from 'hook-fetch/vue';
import { ref } from 'vue';
import { computed, nextTick, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { send } from '@/api';
import FilesSelect from '@/components/FilesSelect/index.vue';
import ModelSelect from '@/components/ModelSelect/index.vue';
import { useChatStore } from '@/stores/modules/chat';
import { useFilesStore } from '@/stores/modules/files';
import { useModelStore } from '@/stores/modules/model';
import { useUserStore } from '@/stores/modules/user';
import { systemProfilePicture, userProfilePicture } from '@/utils/user.ts';
import '@/styles/github-markdown.css';
import '@/styles/yixin-markdown.scss';
@@ -61,6 +62,7 @@ const { stream, loading: isLoading, cancel } = useHookFetch({
userStore.openLoginDialog();
}
},
});
// 记录进入思考中
let isThinking = false;
@@ -121,7 +123,6 @@ function handleDataChunk(chunk: AnyObject) {
// 另一种思考中形式content中有 <think></think> 的格式
// 一开始匹配到 <think> 开始,匹配到 </think> 结束,并处理标签中的内容为思考内容
console.log(chunk.choices, 'chunk.choices');
const parsedChunk = chunk.choices?.[0].delta.content;
if (parsedChunk) {
const thinkStart = parsedChunk.includes('<think>');
@@ -166,8 +167,6 @@ function handleError(err: any) {
async function startSSE(chatContent: string) {
try {
// 添加用户输入的消息
// console.log('chatContent', chatContent);
// 清空输入框
inputValue.value = '';
addMessage(chatContent, true);
@@ -176,23 +175,14 @@ async function startSSE(chatContent: string) {
// 这里有必要调用一下 BubbleList 组件的滚动到底部 手动触发 自动滚动
bubbleListRef.value?.scrollToBottom();
console.log('bubbleItems.value--', bubbleItems.value);
// 使用 for-await 处理流式响应
for await (const chunk of stream({
// messages: bubbleItems.value
// .filter((item: any) => item.role === 'user')
// .map((item: any) => ({
// role: item.role,
// content: item.content,
// })),
messages: bubbleItems.value
.slice(0, -1) // 去掉最后1条即排除最新那条
.slice(-6) // 然后取倒数第2到第7条总共6条
.map((item: MessageItem) => ({
role: item.role,
content: (item.role === 'ai' || item.role === 'assistant') && item.content.length > 2000
? `${item.content.substring(0, 2000)}...(内容过长,已省略)`
: item.content,
})),
messages: bubbleItems.value.slice(0, -1).slice(-6).map((item: MessageItem) => ({
role: item.role,
content: (item.role === 'ai' || item.role === 'assistant') && item.content.length > 2000
? `${item.content.substring(0, 2000)}...(内容过长,已省略)`
: item.content,
})),
sessionId: route.params?.id !== 'not_login' ? String(route.params?.id) : undefined,
userId: userStore.userInfo?.userId,
model: modelStore.currentModelInfo.modelId ?? '',
@@ -201,11 +191,14 @@ async function startSSE(chatContent: string) {
}
}
catch (err) {
console.log('33---');
handleError(err);
if (err.name === 'AbortError') {
console.log('用户中止请求'); // 正常中止,无需提示
}
else {
handleError(err); // 其他错误
}
}
finally {
console.log('数据接收完毕');
// 停止打字器状态
if (bubbleItems.value.length) {
bubbleItems.value[bubbleItems.value.length - 1].typing = false;
@@ -215,10 +208,14 @@ async function startSSE(chatContent: string) {
// 中断请求
async function cancelSSE() {
cancel();
// 结束最后一条消息打字状态
if (bubbleItems.value.length) {
bubbleItems.value[bubbleItems.value.length - 1].typing = false;
try {
cancel(); // 直接调用,无需参数
if (bubbleItems.value.length) {
bubbleItems.value[bubbleItems.value.length - 1].typing = false;
}
}
catch (err) {
handleError(err);
}
}
@@ -228,8 +225,8 @@ function addMessage(message: string, isUser: boolean) {
const obj: MessageItem = {
key: i,
avatar: isUser
? avatar.value
: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
? userProfilePicture
: systemProfilePicture,
avatarSize: '32px',
role: isUser ? 'user' : 'assistant',
placement: isUser ? 'end' : 'start',
@@ -269,7 +266,6 @@ watch(
);
function markdownContent(item: any) {
console.log('item---', item);
return item.content;
}
</script>
@@ -305,9 +301,9 @@ function markdownContent(item: any) {
class="prev-next-btn left-8px flex-center w-22px h-22px rounded-8px border-1px border-solid border-[rgba(0,0,0,0.08)] c-[rgba(0,0,0,.4)] hover:bg-#f3f4f6 bg-#fff font-size-10px"
@click="onScrollLeft"
>
<el-icon>
<ElIcon>
<ArrowLeftBold />
</el-icon>
</ElIcon>
</div>
</template>
@@ -317,9 +313,9 @@ function markdownContent(item: any) {
class="prev-next-btn right-8px flex-center w-22px h-22px rounded-8px border-1px border-solid border-[rgba(0,0,0,0.08)] c-[rgba(0,0,0,.4)] hover:bg-#f3f4f6 bg-#fff font-size-10px"
@click="onScrollRight"
>
<el-icon>
<ElIcon>
<ArrowRightBold />
</el-icon>
</ElIcon>
</div>
</template>
</Attachments>
@@ -327,7 +323,7 @@ function markdownContent(item: any) {
</template>
<template #prefix>
<div class="flex-1 flex items-center gap-8px flex-none w-fit overflow-hidden">
<FilesSelect />
<!-- <FilesSelect /> -->
<ModelSelect />
</div>
</template>

View File

@@ -177,7 +177,6 @@ function openContact() {
dangerouslyUseHTMLString: true,
customClass: 'wechat-message-box',
callback: () => {
console.log('用户已查看微信信息');
},
},
);

View File

@@ -125,7 +125,6 @@ export const useSessionStore = defineStore('session', () => {
// msg: "操作成功",
// data: "1935711019560206338"
// };
console.log('create_session---res--', res);
// 创建会话后立刻查询列表会话
// 1. 先找到被修改会话在 sessionList 中的索引(假设 sessionList 是按服务端排序的完整列表)
const targetIndex = sessionList.value.findIndex(session => session.id === `${res.data}`);

View File

@@ -21,7 +21,6 @@ export const useUserStore = defineStore(
const userInfo = ref<any>();
const setUserInfo = (value: any) => {
userInfo.value = value;
console.log('userInfo', userInfo.value);
};
const clearUserInfo = () => {
userInfo.value = void 0;

View File

@@ -102,8 +102,6 @@ function jwtPlugin(): {
return response;
if (response.result?.code === 403) {
console.log('2222---');
router.replace({ name: '403' });
ElMessage.error(response.result?.msg);
return Promise.reject(response);

View File

@@ -1,10 +0,0 @@
import { useUserStore } from '@/stores/index.js';
const userStore = useUserStore();
// 获取用户角色信息
const userRoles = userStore.userInfo?.roles ?? [];
const isUserVip = userRoles.some(role => role.roleCode === 'YiXinAi-Vip');
export {
isUserVip,
};

View File

@@ -0,0 +1,18 @@
import { useUserStore } from '@/stores/index.js';
const userStore = useUserStore();
// 获取用户角色信息
const userRoles = userStore.userInfo?.roles ?? [];
const isUserVip = userRoles.some((role: any) => role.roleCode === 'YiXinAi-Vip');
// 用户头像
const userProfilePicture = userStore.userInfo?.user?.icon ? `${import.meta.env.VITE_WEB_BASE_API}/file/${userStore.userInfo.user.icon}` : `@/assets/images/user.png`;
// 系统头像
const systemProfilePicture = `@/assets/images/user.png`;
export {
isUserVip,
systemProfilePicture,
userProfilePicture,
};

View File

@@ -39,7 +39,6 @@ export default defineConfig((cnf) => {
bypass(req, res, options) {
//@ts-ignore
const proxyUrl = new URL(options.rewrite(req.url) || '',(options.target)as string)?.href || '';
console.log(proxyUrl);
req.headers['x-req-proxyUrl'] = proxyUrl
res.setHeader('x-res-proxyUrl',proxyUrl)
},