Merge remote-tracking branch 'origin/feature/v1.3_主agent_rxd' into test

This commit is contained in:
rd
2025-08-29 10:30:24 +08:00
3 changed files with 18 additions and 9 deletions

View File

@ -30,7 +30,8 @@ export default {
const senderRef = ref(null); const senderRef = ref(null);
const localSearchValue = ref(props.modelValue); const localSearchValue = ref(props.modelValue);
// 监听外部value变化 const isEmptyValue = computed(() => !localSearchValue.value.trim());
watch( watch(
() => props.modelValue, () => props.modelValue,
(newValue) => { (newValue) => {
@ -39,6 +40,10 @@ export default {
); );
const handleSubmit = () => { const handleSubmit = () => {
if (isEmptyValue.value) {
return;
}
emit('submit', localSearchValue.value); emit('submit', localSearchValue.value);
// localSearchValue.value = '' // localSearchValue.value = ''
}; };
@ -65,7 +70,7 @@ export default {
<div <div
onClick={handleSubmit} onClick={handleSubmit}
class={`submit-btn w-32px h-32px p-6px flex justify-center items-center rounded-50% cursor-pointer ${ class={`submit-btn w-32px h-32px p-6px flex justify-center items-center rounded-50% cursor-pointer ${
!localSearchValue.value ? 'opacity-50' : '' isEmptyValue.value ? 'opacity-50' : ''
}`} }`}
> >
<icon-arrow-right size={20} class="color-#FFFFFF" /> <icon-arrow-right size={20} class="color-#FFFFFF" />
@ -83,7 +88,7 @@ export default {
<Sender <Sender
v-model:value={localSearchValue.value} v-model:value={localSearchValue.value}
ref={senderRef} ref={senderRef}
onChange={(value: string) => emit('update:modelValue', value)} onChange={(value: string) => emit('update:modelValue', value.trim())}
onSubmit={handleSubmit} onSubmit={handleSubmit}
class="h-full w-full mb-24px" class="h-full w-full mb-24px"
placeholder={props.placeholder} placeholder={props.placeholder}

View File

@ -84,7 +84,6 @@ export default {
agent_id: chatStore.agentInfo.agent_id, agent_id: chatStore.agentInfo.agent_id,
}), }),
}); });
} catch (error) { } catch (error) {
console.error('Failed to initialize SSE:', error); console.error('Failed to initialize SSE:', error);
antdMessage.error('初始化连接失败'); antdMessage.error('初始化连接失败');

View File

@ -30,15 +30,20 @@ export default {
const senderRef = ref(null); const senderRef = ref(null);
const localSearchValue = ref(props.modelValue); const localSearchValue = ref(props.modelValue);
// 监听外部value变化 const isEmptyValue = computed(() => !localSearchValue.value.trim());
watch( watch(
() => props.modelValue, () => props.modelValue,
(newValue) => { (newValue) => {
console.log(newValue);
localSearchValue.value = newValue || ''; localSearchValue.value = newValue || '';
}, },
); );
const handleSubmit = () => { const handleSubmit = () => {
if (isEmptyValue.value) {
return;
}
emit('submit', localSearchValue.value); emit('submit', localSearchValue.value);
}; };
const handleCancel = () => { const handleCancel = () => {
@ -64,7 +69,7 @@ export default {
<div <div
onClick={handleSubmit} onClick={handleSubmit}
class={`submit-btn w-32px h-32px p-6px flex justify-center items-center rounded-50% cursor-pointer ${ class={`submit-btn w-32px h-32px p-6px flex justify-center items-center rounded-50% cursor-pointer ${
!localSearchValue.value ? 'opacity-50' : '' isEmptyValue.value ? 'opacity-50' : ''
}`} }`}
> >
<icon-arrow-right size={20} class="color-#FFFFFF" /> <icon-arrow-right size={20} class="color-#FFFFFF" />
@ -81,7 +86,7 @@ export default {
<Sender <Sender
v-model:value={localSearchValue.value} v-model:value={localSearchValue.value}
ref={senderRef} ref={senderRef}
onChange={(value: string) => emit('update:modelValue', value)} onChange={(value: string) => emit('update:modelValue', value.trim())}
onSubmit={handleSubmit} onSubmit={handleSubmit}
class="h-full w-full mb-24px" class="h-full w-full mb-24px"
placeholder={props.placeholder} placeholder={props.placeholder}