| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import generateClientUniqueId from '../../utils/generate-client-unique-id';
- import { getIcon4Question } from './get-icon-4-dialog';
- /**
- * 格式化用户的对话历史记录的提问数据
- */
- export default function formatDialogQuestionByHistory(item, agentInfo) {
- const agent_icon = agentInfo?.agent?.icon || '';
- const icon_src = getIcon4Question(agent_icon);
- return {
- /**
- * 对话消息类别
- * 0 历史消息
- * 1 新消息(本次进入页面新建的消息,但是已经结束轮次)
- * 2 当前的消息(此刻正在进行中的消息)
- */
- client_custom_chat_type: 0,
- /**
- * 此项的类别
- * a 智能体的回答
- * q 客户端的提问
- */
- client_custom_item_type: 'q', // 回答的答案
- /**
- * 会话展示时,可以通过此值,判断该如何进行内容显示
- * 当值为0时,可能显示加载中动画
- * 当值为1时,展示消息内容,展示 停止生成按钮
- * 当值为2时,可能展示反馈操作按钮
- */
- client_custom_chat_status: 2, // 此轮会话的状态值 0 加载中 1 进行中 2 已结束
- // 图标
- client_custom_icon: icon_src,
- client_custom_unique_id: generateClientUniqueId(item.content),
- question: item.content,
- client_custom_upload_file_list: item.files
- };
- }
|