Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions packages/pro-components/chat/chatbot/_example/agui.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,24 @@
@send="sendHandler"
@stop="stopHandler"
>
<template #suffix="{ renderPresets }">
<!-- 在这里可以进行自由的组合使用,或者新增预设 -->
<!-- 不需要附件操作的使用方式 -->
<component :is="renderPresets([])" />
<template #input-prefix> <Robot2Icon size="large" style="margin-top: 2px; margin-right: 10px" /> </template>
<template #suffix>
<t-button size="small" variant="text" @click="handleCustomButtonClick">
<template #icon>
<AiEditIcon />
</template>
</t-button>
</template>
</t-chat-sender>

<t-dialog
v-model:visible="dialogVisible"
title="输入内容"
@confirm="handleDialogCancel"
@cancel="handleDialogCancel"
>
<div>{{ dialogInputValue }}</div>
</t-dialog>
</div>
</template>

Expand All @@ -65,11 +77,14 @@ import {
useChat,
} from '@tdesign-vue-next/chat';
import { MessagePlugin } from 'tdesign-vue-next';
import { AiEditIcon, Robot2Icon } from 'tdesign-icons-vue-next';
import CustomToolCallRenderer from './components/Toolcall.vue';

const listRef = ref<TdChatListApi | null>(null);
const inputRef = ref<TdChatSenderApi | null>(null);
const inputValue = ref<string>('AG-UI协议的作用是什么');
const dialogVisible = ref(false);
const dialogInputValue = ref('');

const { chatEngine, messages, status } = useChat({
defaultMessages: [],
Expand Down Expand Up @@ -168,6 +183,17 @@ const sendHandler = async (params) => {
const stopHandler = () => {
chatEngine.value?.abortChat();
};

// 自定义按钮点击处理
const handleCustomButtonClick = () => {
dialogVisible.value = true;
dialogInputValue.value = inputValue.value;
};

// 弹窗关闭处理
const handleDialogCancel = () => {
dialogVisible.value = false;
};
</script>

<style scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@
@send="sendHandler"
@stop="stopHandler"
>
<template #suffix="{ renderPresets }">
<!-- 在这里可以进行自由的组合使用,或者新增预设 -->
<template #suffix>
<!-- 不需要附件操作的使用方式 -->
<component :is="renderPresets([])" />
<t-button size="small" variant="text">
<template #icon>
<AppIcon />
</template>
</t-button>
</template>
</t-chat-sender>
</div>
Expand Down
10 changes: 10 additions & 0 deletions packages/tdesign-vue-next-chat/.changelog/pr-6519.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
pr_number: 6519
contributor: RSS1102
---

- fix(chatbot): `senderProps` 中配置 `input-prefix` 不生效问题 @RSS1102 ([#6519](https://github.com/Tencent/tdesign-vue-next/pull/6519))
- fix(chat-sender): suffix 支持 `[{ name: 'uploadImage', uploadProps: {...} }]` 配置 @RSS1102 ([#6519](https://github.com/Tencent/tdesign-vue-next/pull/6519))
- fix(chat-sender): suffix 配置 `attachment` 即将废弃,建议使用 `uploadAttachment` @RSS1102 ([#6519](https://github.com/Tencent/tdesign-vue-next/pull/6519))
- Breaking Change: @RSS1102 ([#6519](https://github.com/Tencent/tdesign-vue-next/pull/6519))
- ⚠️ attachment 别名即将废弃,建议使用 uploadAttachment @RSS1102 ([#6519](https://github.com/Tencent/tdesign-vue-next/pull/6519))
2 changes: 1 addition & 1 deletion packages/tdesign-vue-next-chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"marked-highlight": "catalog:docs",
"tdesign-icons-vue-next": "catalog:tdesign",
"tdesign-vue-next": "workspace:^",
"tdesign-web-components": "1.3.1-alpha.10",
"tdesign-web-components": "1.3.1-alpha.11",
"omi-vueify": "^0.0.12"
},
"devDependencies": {
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading