format-dialog-question-by-client.js 886 B

12345678910111213141516171819202122232425262728293031323334
  1. import generateClientUniqueId from '../../utils/generate-client-unique-id';
  2. import { getIcon4Question } from './get-icon-4-dialog';
  3. /**
  4. * 组装客户端用户提问的数据
  5. */
  6. export default function formatDialogQuestionByClient(text, client_file_list, agentInfo) {
  7. const cur_stamp = Date.now();
  8. const icon_src = getIcon4Question(agentInfo);
  9. return {
  10. /**
  11. * 此项的类别
  12. * a 智能体的回答
  13. * q 客户端的提问
  14. */
  15. client_custom_item_type: 'q', // 提问
  16. client_custom_create_time: cur_stamp, // 创建的时间戳
  17. client_custom_unique_id: generateClientUniqueId(text + cur_stamp),
  18. /**
  19. * 客户端上传的文件列表
  20. * 如果有此参数,则需要在问题处进行展示
  21. */
  22. client_custom_upload_file_list: client_file_list,
  23. // 图标
  24. client_custom_icon: icon_src,
  25. question: text
  26. };
  27. }