feat: glm-z1-flash只能深度思考,隐藏深度思考按钮

This commit is contained in:
肖应宇 2026-03-12 11:59:20 +08:00
parent bb44134e08
commit ecff6edd61
1 changed files with 12 additions and 9 deletions

View File

@ -97,7 +97,9 @@
<Minimize2 v-else :size="16" /> <Minimize2 v-else :size="16" />
</button> </button>
<!-- 深度思考开关 --> <!-- 深度思考开关 -->
<!-- 如果模型不是glm-z1-flash则显示深度思考开关 -->
<button <button
v-if="modelName !== 'glm-z1-flash'"
class="toolbar-btn" class="toolbar-btn"
:class="{ active: isDeepThinking, disabled: !supports_thinking }" :class="{ active: isDeepThinking, disabled: !supports_thinking }"
:disabled="!supports_thinking" :disabled="!supports_thinking"
@ -131,7 +133,6 @@
<Globe :size="16" /> <Globe :size="16" />
<span>联网搜索</span> <span>联网搜索</span>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
@ -201,6 +202,7 @@ const emit = defineEmits<{
// //
const authStore = useAuthStore(); const authStore = useAuthStore();
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
const modelName = computed(() => settingsStore.settings.defaultModel);
const inputText = ref(""); const inputText = ref("");
const attachments = ref<AttachmentWithProgress[]>([]); const attachments = ref<AttachmentWithProgress[]>([]);
@ -224,7 +226,7 @@ const imageInputRef = ref<HTMLInputElement | null>(null);
let lastToastTime = 0; let lastToastTime = 0;
const toastThrottleMs = 2000; const toastThrottleMs = 2000;
function showThrottledToast(message: string, type: 'error' = 'error') { function showThrottledToast(message: string, type: "error" = "error") {
const now = Date.now(); const now = Date.now();
if (now - lastToastTime >= toastThrottleMs) { if (now - lastToastTime >= toastThrottleMs) {
lastToastTime = now; lastToastTime = now;
@ -252,7 +254,7 @@ function autoResize() {
textarea.style.height = "auto"; textarea.style.height = "auto";
const maxHeight = isExpanded.value ? 400 : 160; const maxHeight = isExpanded.value ? 400 : 160;
// 1px // 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 currentLength = inputText.value.length;
const insertLength = event.data?.length || 0; 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 selectionEnd = (event.target as HTMLTextAreaElement).selectionEnd || 0;
const selectedLength = selectionEnd - selectionStart; const selectedLength = selectionEnd - selectionStart;
@ -321,7 +324,7 @@ async function handlePaste(event: ClipboardEvent) {
if (!items) return; if (!items) return;
// //
const text = event.clipboardData?.getData('text'); const text = event.clipboardData?.getData("text");
if (text) { if (text) {
const textarea = event.target as HTMLTextAreaElement; const textarea = event.target as HTMLTextAreaElement;
const selectionStart = textarea.selectionStart || 0; const selectionStart = textarea.selectionStart || 0;
@ -388,7 +391,7 @@ async function addFileAsAttachment(
) { ) {
// //
if (!authStore.isAuthenticated) { if (!authStore.isAuthenticated) {
window.$toast?.('请先登录', 'error'); window.$toast?.("请先登录", "error");
return; return;
} }
@ -452,17 +455,17 @@ async function removeAttachment(id: string) {
const attachment = attachments.value[index]; const attachment = attachments.value[index];
// OSS blob URL OSS // OSS blob URL OSS
if (attachment.url && !attachment.url.startsWith('blob:')) { if (attachment.url && !attachment.url.startsWith("blob:")) {
try { try {
await chatApi.deleteAttachment(attachment.url); await chatApi.deleteAttachment(attachment.url);
} catch (error) { } catch (error) {
console.error('删除 OSS 文件失败:', error); console.error("删除 OSS 文件失败:", error);
// 使 // 使
} }
} }
// blob URL // blob URL
if (attachment.url.startsWith('blob:')) { if (attachment.url.startsWith("blob:")) {
URL.revokeObjectURL(attachment.url); URL.revokeObjectURL(attachment.url);
} }