<script setup lang="ts">
const apiConfig = {
  defaultApiUrl: "https://api.openai.com/v1",
  authType: "API_KEY",
  requestHeaderKey: "Authorization",
  requestHeaderValuePrefix: "Bearer",
  extraConfig: "{ timeout: 5000, proxy: 'http://proxy.example.com' }",
  timeOut:'30',
  reTry:'3'
}
// 格式化 JSON
const formattedExtraConfig = computed(() => {
  return JSON.stringify(apiConfig.extraConfig, null, 2)
})
</script>

<template>
  <h3>API配置</h3>
  <el-descriptions :column="2" border>
    <el-descriptions-item label="默认API地址">{{ apiConfig.defaultApiUrl }}</el-descriptions-item>
    <el-descriptions-item label="认证方式">{{ apiConfig.authType }}</el-descriptions-item>
    <el-descriptions-item label="请求头Key">{{ apiConfig.requestHeaderKey }}</el-descriptions-item>
    <el-descriptions-item label="拓展配置">
  <pre style="white-space: pre-wrap; word-break: break-word; background: #f5f7fa; padding: 10px; border-radius: 4px;">
    {{ formattedExtraConfig }}
  </pre>
    </el-descriptions-item>
    <el-descriptions-item label="请求头Value前缀">{{ apiConfig.requestHeaderValuePrefix }}</el-descriptions-item>
    <el-descriptions-item label="请求超时时间">{{ apiConfig.timeOut }}</el-descriptions-item>
    <el-descriptions-item label="重试次数">{{ apiConfig.reTry }}</el-descriptions-item>
  </el-descriptions>
</template>

<style scoped lang="scss">

</style>
