zhou zhou
10 小时以前 50e95b985a72fcec4a93a2470e9efdfb2620148a
rsf-design/src/views/system/ai-param/aiParamPage.helpers.js
@@ -1,16 +1,18 @@
const AI_PARAM_REPORT_TITLE = 'AI 参数报表'
import { $t } from '@/locales'
const AI_PARAM_REPORT_TITLE = () => $t('pages.system.aiParam.reportTitle')
const PROVIDER_OPTIONS = [{ label: 'OPENAI_COMPATIBLE', value: 'OPENAI_COMPATIBLE' }]
const STATUS_OPTIONS = [
  { label: '默认', value: 1 },
  { label: '候选', value: 0 }
  { label: () => $t('pages.system.aiParam.status.default'), value: 1 },
  { label: () => $t('pages.system.aiParam.status.candidate'), value: 0 }
]
const VALIDATE_STATUS_META = {
  VALID: { text: '已校验', type: 'success' },
  INVALID: { text: '校验失败', type: 'danger' },
  NOT_TESTED: { text: '未校验', type: 'info' }
  VALID: { text: () => $t('pages.system.aiParam.validation.valid'), type: 'success' },
  INVALID: { text: () => $t('pages.system.aiParam.validation.invalid'), type: 'danger' },
  NOT_TESTED: { text: () => $t('pages.system.aiParam.validation.notTested'), type: 'info' }
}
function createAiParamSearchState() {
@@ -58,17 +60,21 @@
}
function getAiParamStatusOptions() {
  return STATUS_OPTIONS
  return STATUS_OPTIONS.map((item) => ({ ...item, label: item.label() }))
}
function getAiParamStatusMeta(status) {
  return Number(status) === 1
    ? { text: '默认', type: 'success' }
    : { text: '候选', type: 'info' }
    ? { text: $t('pages.system.aiParam.status.default'), type: 'success' }
    : { text: $t('pages.system.aiParam.status.candidate'), type: 'info' }
}
function getAiParamValidateStatusMeta(status) {
  return VALIDATE_STATUS_META[String(status || '').trim()] || { text: status || '未知', type: 'info' }
  const meta = VALIDATE_STATUS_META[String(status || '').trim()]
  if (meta) {
    return { text: meta.text(), type: meta.type }
  }
  return { text: status || $t('common.status.unknown'), type: 'info' }
}
function buildAiParamSearchParams(params = {}) {
@@ -150,7 +156,9 @@
    validateStatusText: validateMeta.text,
    validateStatusType: validateMeta.type,
    streamingEnabled: Boolean(record.streamingEnabled),
    streamingText: record.streamingEnabled ? '流式响应' : '标准响应',
    streamingText: record.streamingEnabled
      ? $t('pages.system.aiParam.streaming.enabled')
      : $t('pages.system.aiParam.streaming.disabled'),
    'createTime$': normalizeText(record['createTime$']),
    'updateTime$': normalizeText(record['updateTime$']),
    'lastValidateTime$': normalizeText(record['lastValidateTime$'])
@@ -175,14 +183,14 @@
function getAiParamReportColumns() {
  return [
    { label: '名称', prop: 'name' },
    { label: '提供方', prop: 'providerType' },
    { label: '模型', prop: 'model' },
    { label: '默认状态', prop: 'statusText' },
    { label: '校验状态', prop: 'validateStatusText' },
    { label: '超时时间(ms)', prop: 'timeoutMs' },
    { label: '更新时间', prop: 'updateTime' },
    { label: '备注', prop: 'memo' }
    { label: $t('pages.system.aiParam.table.name'), prop: 'name' },
    { label: $t('pages.system.aiParam.table.providerType'), prop: 'providerType' },
    { label: $t('pages.system.aiParam.table.model'), prop: 'model' },
    { label: $t('pages.system.aiParam.table.status'), prop: 'statusText' },
    { label: $t('pages.system.aiParam.table.validateStatus'), prop: 'validateStatusText' },
    { label: $t('pages.system.aiParam.table.timeoutMs'), prop: 'timeoutMs' },
    { label: $t('table.updateTime'), prop: 'updateTime' },
    { label: $t('table.remark'), prop: 'memo' }
  ]
}