From ecff6edd61e141265180c29162164869d651f616 Mon Sep 17 00:00:00 2001
From: MT-Fire <798521692@qq.com>
Date: Thu, 12 Mar 2026 11:59:20 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20glm-z1-flash=E5=8F=AA=E8=83=BD=E6=B7=B1?=
=?UTF-8?q?=E5=BA=A6=E6=80=9D=E8=80=83=EF=BC=8C=E9=9A=90=E8=97=8F=E6=B7=B1?=
=?UTF-8?q?=E5=BA=A6=E6=80=9D=E8=80=83=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/input/ChatInput.vue | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/components/input/ChatInput.vue b/src/components/input/ChatInput.vue
index 6190a7f..ad5e3d7 100644
--- a/src/components/input/ChatInput.vue
+++ b/src/components/input/ChatInput.vue
@@ -97,7 +97,9 @@
+
联网搜索
-
@@ -201,6 +202,7 @@ const emit = defineEmits<{
// 响应式状态
const authStore = useAuthStore();
const settingsStore = useSettingsStore();
+const modelName = computed(() => settingsStore.settings.defaultModel);
const inputText = ref("");
const attachments = ref([]);
@@ -224,7 +226,7 @@ const imageInputRef = ref(null);
let lastToastTime = 0;
const toastThrottleMs = 2000;
-function showThrottledToast(message: string, type: 'error' = 'error') {
+function showThrottledToast(message: string, type: "error" = "error") {
const now = Date.now();
if (now - lastToastTime >= toastThrottleMs) {
lastToastTime = now;
@@ -252,7 +254,7 @@ function autoResize() {
textarea.style.height = "auto";
const maxHeight = isExpanded.value ? 400 : 160;
// 增加1px是为了避免滚动条出现
- textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)+1}px`;
+ textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight) + 1}px`;
}
// 处理输入前事件,限制字数
@@ -263,7 +265,8 @@ function handleBeforeInput(event: InputEvent) {
// 检查输入后是否会超过限制
const currentLength = inputText.value.length;
const insertLength = event.data?.length || 0;
- const selectionStart = (event.target as HTMLTextAreaElement).selectionStart || 0;
+ const selectionStart =
+ (event.target as HTMLTextAreaElement).selectionStart || 0;
const selectionEnd = (event.target as HTMLTextAreaElement).selectionEnd || 0;
const selectedLength = selectionEnd - selectionStart;
@@ -321,7 +324,7 @@ async function handlePaste(event: ClipboardEvent) {
if (!items) return;
// 检查粘贴文本是否会超过字数限制
- const text = event.clipboardData?.getData('text');
+ const text = event.clipboardData?.getData("text");
if (text) {
const textarea = event.target as HTMLTextAreaElement;
const selectionStart = textarea.selectionStart || 0;
@@ -388,7 +391,7 @@ async function addFileAsAttachment(
) {
// 检查认证状态
if (!authStore.isAuthenticated) {
- window.$toast?.('请先登录', 'error');
+ window.$toast?.("请先登录", "error");
return;
}
@@ -452,17 +455,17 @@ async function removeAttachment(id: string) {
const attachment = attachments.value[index];
// 如果已上传到 OSS(不是本地 blob URL),则从 OSS 删除
- if (attachment.url && !attachment.url.startsWith('blob:')) {
+ if (attachment.url && !attachment.url.startsWith("blob:")) {
try {
await chatApi.deleteAttachment(attachment.url);
} catch (error) {
- console.error('删除 OSS 文件失败:', error);
+ console.error("删除 OSS 文件失败:", error);
// 即使删除失败也继续移除本地引用
}
}
// 释放 blob URL(如果是本地的)
- if (attachment.url.startsWith('blob:')) {
+ if (attachment.url.startsWith("blob:")) {
URL.revokeObjectURL(attachment.url);
}