From 4f33e1e616e2a59112a6265073124abd7f0e81ed Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期二, 25 二月 2025 16:00:27 +0800
Subject: [PATCH] 修改地图

---
 src/components/chat/smallChat/ChatInput.vue |   75 +++++++++++++++++++++++++++++++++----
 1 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/src/components/chat/smallChat/ChatInput.vue b/src/components/chat/smallChat/ChatInput.vue
index 7e78a9f..e06cfba 100644
--- a/src/components/chat/smallChat/ChatInput.vue
+++ b/src/components/chat/smallChat/ChatInput.vue
@@ -1,7 +1,15 @@
 <template>
 	<div class="playInput !w-full hl_input rounded-[22px] input-border input-shadow">
-		<div class="set-input">
-			<!-- @input="inputText" -->
+		<div class="set-input flex items-center">
+			<!-- 娣诲姞鍘嗗彶璁板綍鎸夐挳 -->
+			<el-tooltip placement="top" content="鍘嗗彶璁板綍">
+				<div class="history-btn ml-2 mr-2 cursor-pointer text-gray-400 hover:text-gray-600" @click="toggleHistory">
+					<el-icon :class="{ 'text-blue-500': showHistory }" class="text-[27px]">
+						<Clock />
+					</el-icon>
+				</div>
+			</el-tooltip>
+
 			<el-input
 				ref="inputRef"
 				class="question-input relative align-bottom set-inputAnswer"
@@ -11,12 +19,14 @@
 				:autosize="{ minRows: 1, maxRows: 3 }"
 				v-elInputFocus
 				show-word-limit
+				@input="inputting"
 				v-model="inputText"
-				placeholder="鍦ㄨ繖閲岃緭鍏ユ偍鐨勯棶棰樺紑濮嬪拰AI瀵硅瘽"
+				placeholder="璇疯緭鍏ユ搷浣�"
 				clearable
-				@keyup.enter="emits('sendClick')"
+				@keydown="keydownInput"
 			>
 			</el-input>
+			<InputTip ref="inputTipRef" :inputValue="inputText" @updateInputValue="updateInputValue" :isHome="false" />
 		</div>
 		<div class="h100 flex items-end">
 			<div class="upload_img space-y">
@@ -53,32 +63,79 @@
 </template>
 
 <script setup lang="ts" name="ChatInput">
-import { onMounted } from 'vue';
-import { Logger } from '/@/model/logger/Logger';
-import { agentStreamByPost } from '/@/api/ai/chat';
-
+import { Clock } from '@element-plus/icons-vue';
+import type { InputInstance } from 'element-plus';
+import { useInputEvent } from './useInputEvent';
+import InputTip from './inputTip/index.vue';
+import { ref } from 'vue';
 const inputText = defineModel('modelValue', {
 	type: String,
 	default: '',
 });
+
 const props = defineProps({
 	isTalking: {
 		type: Boolean,
 		default: false,
 	},
+	showHistory: {
+		type: Boolean,
+		default: false,
+	},
 });
-const emits = defineEmits(['sendClick', 'stopGenClick']);
+
+const emits = defineEmits(['sendClick', 'stopGenClick', 'toggleHistory']);
+
+// 澶勭悊鍥炶溅浜嬩欢
+const handleEnterPress = (e: KeyboardEvent) => {
+	// 濡傛灉鎸変綇浜� shift 閿紝鍒欏厑璁告崲琛�
+	if (e.shiftKey) {
+		return;
+	}
+	// 鍚﹀垯鍙戦�佹秷鎭�
+	e.preventDefault(); // 闃绘榛樿鐨勬崲琛岃涓�
+	if (inputText.value.trim()) {
+		emits('sendClick');
+	}
+};
 
 const clearTextarea = () => {
 	inputText.value = '';
 };
 
+// 澶勭悊鍘嗗彶璁板綍鏄剧ず/闅愯棌
+const toggleHistory = () => {
+	emits('toggleHistory');
+};
 
+const updateInputValue = (val) => {
+	inputText.value = val;
+};
+
+const inputRef = ref<InputInstance>(null);
+
+const { keydownInput, inputText:inputting, inputTipRef } = useInputEvent({
+	props: props,
+	emit: emits,
+	inputValue: inputText,
+	inputRef: inputRef,
+});
 </script>
+
 <style scoped lang="scss">
 @use './chatInput.scss';
 .playInput {
 	--y-padding: 7px;
 	--x-padding: 14px;
 }
+
+.history-btn {
+	padding: 4px;
+	border-radius: 4px;
+	transition: all 0.3s;
+
+	&:hover {
+		background-color: rgba(0, 0, 0, 0.05);
+	}
+}
 </style>

--
Gitblit v1.9.3