<template>
  <div class="agent-card">
    <div class="header-section">
      <div class="image-container">
        <img :src="cozeInfo.icon_url" alt="" />
      </div>
    </div>
    <div class="info-section">
      <div class="title-group">
        <div class="title">{{cozeInfo.name}}</div>
        <div class="tag">
          <div class="">
            <img
              class="status-icon"
              :src="workflow"
            />
          </div>
          <div class="text">工作流</div>
        </div>
      </div>
      <div class="usage-info">
        <div class="count">{{cozeInfo.views}}</div>
        <div class="label">次使用</div>
      </div>
    </div>
    <div class="description-section">
      <div class="description">
        {{cozeInfo.description}}
      </div>
    </div>
    <div class="divider"></div>
    <!--    <div class="history-section">-->
    <!--      <div class="history-title">-->
    <!--        <div class="text">历史对话</div>-->
    <!--      </div>-->
    <!--      <div class="history-list">-->
    <!--        <div class="history-item">-->
    <!--          <div class="item-text">梳理这次舆情的时间线和关键节点</div>-->
    <!--        </div>-->

    <!--      </div>-->
    <!--    </div>-->
  </div>
</template>

<script lang="ts" setup>
import { defineProps } from 'vue';
import { delAgentMessage, getHistoryChat } from '@/api/all/agent';
import workflow from '@/assets/svg/workflow.svg';

const props = defineProps({
  cozeInfo: {
    type: Object as () => any,
    default: () => ({}),
  },
});

const delMessage = async (chatId, conversationId) => {
  const { code, data } = await delAgentMessage({ chat_id: chatId, conversation_id: conversationId });
  if (code === 200) {
    console.log(data, 'data');
  }
};

const conversations = ref([]);

const getHistoryChatData = async (botId) => {
  const { code, data } = await getHistoryChat({ bot_id: botId });
  if (code === 200) {
    conversations.value = data.list;
  }
};
const truncateText = (text: string, maxLength = 30) => {
  if (text.length <= maxLength) return text;
  return text.slice(0, maxLength) + '...';
};

onMounted(() => {
});
</script>

<style scoped>
@import './history.scss';
</style>
