Detail.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <detail
  3. :onManager="onManager"
  4. :data="data"
  5. :base-info="baseInfo"
  6. :extra-info="extraInfo"
  7. status-module="sku"
  8. resource="llm_skus" />
  9. </template>
  10. <script>
  11. import WindowsMixin from '@/mixins/windows'
  12. import {
  13. getDeviceModelTableColumn,
  14. getImageTableColumn,
  15. getBandwidthTableColumn,
  16. getCpuTableColumn,
  17. getMemoryTableColumn,
  18. getDiskTableColumn,
  19. getLlmTypeTableColumn,
  20. getLlmModelNameTableColumn,
  21. } from '../utils/columns'
  22. import { getLlmSpecSections, fetchLlmSpecCredentialNames, fetchLlmSpecDifyImages } from '../utils/llmSpecDetail'
  23. export default {
  24. name: 'LlmSkuDetail',
  25. mixins: [WindowsMixin],
  26. props: {
  27. data: {
  28. type: Object,
  29. required: true,
  30. },
  31. onManager: {
  32. type: Function,
  33. required: true,
  34. },
  35. },
  36. data () {
  37. return {
  38. credentialNamesMap: {},
  39. difyImageNamesMap: {},
  40. baseInfo: [
  41. getDeviceModelTableColumn(),
  42. getImageTableColumn({ vm: this }),
  43. getBandwidthTableColumn(),
  44. getLlmTypeTableColumn(),
  45. getLlmModelNameTableColumn({ vm: this }),
  46. getCpuTableColumn(),
  47. getMemoryTableColumn(),
  48. getDiskTableColumn(),
  49. {
  50. field: 'port_mappings',
  51. title: this.$t('aice.container_port_mapping'),
  52. slots: {
  53. default: ({ row }) => {
  54. const access_infos = row.port_mappings
  55. if (access_infos?.length) {
  56. const colors = ['pink', 'red', 'orange', 'green', 'cyan', 'blue', 'purple']
  57. return access_infos.map((item, idx) => {
  58. const color = colors[idx % 7]
  59. return <p>
  60. <a-tag color={color} style={{ width: '250px' }}>
  61. {item.protocol.toUpperCase()}: {this.$t('aice.container_port')} {item.container_port}
  62. </a-tag>
  63. </p>
  64. })
  65. }
  66. return '-'
  67. },
  68. },
  69. },
  70. ],
  71. }
  72. },
  73. computed: {
  74. extraInfo () {
  75. return getLlmSpecSections(this)
  76. },
  77. },
  78. watch: {
  79. 'data.llm_spec': {
  80. handler () {
  81. fetchLlmSpecCredentialNames(this)
  82. fetchLlmSpecDifyImages(this)
  83. },
  84. deep: true,
  85. },
  86. },
  87. created () {
  88. fetchLlmSpecCredentialNames(this)
  89. fetchLlmSpecDifyImages(this)
  90. },
  91. }
  92. </script>