import {ElTag} from "element-plus";
import {ref} from "vue";
import {ProviderEnum} from "@/views/ai/model/chatModel/composables/provider";

export default function () {
  const formData = ref({
    provider: ProviderEnum.OPENAI
  })
  const editRef = ref()
  const baseColumns = [
    {
      label: '模型别名',
      field: 'name',
    },
    {
      label: '模型版本',
      field: 'model',
      width: '160',
    },
    {
      label: '向量纬度',
     field: 'dimension',
      align: 'center',
      width: '100',
      render(row) {
        return h(
          ElTag,
          {
            size: 'small',
          },
          {
            default: () => row.dimension,
          }
        );
      },
    },
    {
      label: 'Api Key',
      field: 'apiKey',
    },
    {
      label: 'Base Url',
      field: 'baseUrl',
    },
  ];
  const tableData = ref([])
  const open = () => {
    editRef.value.show({provider: formData.value.provider});
  }
  return {
    baseColumns,
    tableData,
    formData,
    editRef,
    open
  }
}
