aichat.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view>
  3. <tn-nav-bar fixed customBack>
  4. <view slot="back" class='tn-custom-nav-bar__back' @click="goBack">
  5. <text class='icon tn-icon-left'></text>
  6. </view>
  7. <view slot="default" style="display: flex;">
  8. <view style="flex:1;">
  9. <text :style="{fontSize:(wxFontSize)+'px'}">速立保AI</text>
  10. </view>
  11. </view>
  12. </tn-nav-bar>
  13. <!-- index.wxml -->
  14. <!-- <navigationBar></navigationBar> -->
  15. <!-- <button open-type="contact" bindcontact="handleContact" session-from="sessionFrom">111</button> -->
  16. <agent-ui :agentConfig="agentConfig" showBotAvatar="true" chatMode="bot"></agent-ui>
  17. </view>
  18. </template>
  19. <script>
  20. import agentUi from '@/components/agent-ui/index';
  21. // index.js
  22. export default {
  23. components: {
  24. agentUi
  25. },
  26. data() {
  27. return {
  28. agentConfig: {
  29. type: 'bot',
  30. // 值为'bot'或'model'。当type='bot'时,botId必填;当type='model'时,modelName和model必填
  31. botId: 'bot-df4c8ed6',
  32. // agent id
  33. showBotAvatar:true,// 是否在对话框左侧显示头像
  34. allowWebSearch: true,
  35. // 允许客户端选择启用联网搜索
  36. allowUploadFile: true,
  37. // 允许上传文件
  38. allowPullRefresh: true // 允许下拉刷新
  39. // 具体的模型版本
  40. // logo: 'https://cloud1-6g83nk504b196aa9-1328241815.tcloudbaseapp.com/resources/2025-03/lowcode-2171303',
  41. // 图标(只在model模式下生效)
  42. // welcomeMessage: '' // 欢迎语(只在model模式下生效)
  43. }
  44. };
  45. },
  46. methods: {
  47. goBack() {
  48. const pages = getCurrentPages()
  49. // 有可返回的页面则直接返回,uni.navigateBack 默认返回失败之后会自动刷新页面 ,无法继续返回
  50. if (pages.length > 1) {
  51. uni.navigateBack()
  52. return;
  53. }else{
  54. uni.reLaunch({
  55. url: '/pages/index/index'
  56. })
  57. }
  58. },
  59. }
  60. };
  61. </script>
  62. <style lang="scss" scoped>
  63. /* 胶囊*/
  64. .tn-custom-nav-bar__back {
  65. width: 60%;
  66. height: 100%;
  67. position: relative;
  68. display: flex;
  69. justify-content: space-evenly;
  70. align-items: center;
  71. box-sizing: border-box;
  72. border-radius: 1000rpx;
  73. border: 1rpx solid rgba(255, 255, 255, 0.5);
  74. font-size: 18px;
  75. .icon {
  76. display: block;
  77. flex: 1;
  78. margin: auto;
  79. text-align: center;
  80. }
  81. &:before {
  82. content: " ";
  83. width: 1rpx;
  84. height: 110%;
  85. position: absolute;
  86. top: 22.5%;
  87. left: 0;
  88. right: 0;
  89. margin: auto;
  90. transform: scale(0.5);
  91. transform-origin: 0 0;
  92. pointer-events: none;
  93. box-sizing: border-box;
  94. opacity: 0.7;
  95. background-color: #FFFFFF;
  96. }
  97. }
  98. </style>