feat: 完善 Prompt 管理与生成流程配置
This commit is contained in:
32
RuoYi-Vue/tmp-logs/qing-ui-preview/src/utils/dict.js
Normal file
32
RuoYi-Vue/tmp-logs/qing-ui-preview/src/utils/dict.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const dictData = {}
|
||||
|
||||
const emptyDict = []
|
||||
|
||||
function normalizeOptions(options) {
|
||||
if (!Array.isArray(options)) {
|
||||
return emptyDict
|
||||
}
|
||||
return options.map((option) => {
|
||||
const label = option.label || option.name || option.value
|
||||
const value = option.value || label
|
||||
return {
|
||||
...option,
|
||||
label,
|
||||
name: option.name || label,
|
||||
value
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
getDictDataByType(type) {
|
||||
return normalizeOptions(dictData[type])
|
||||
},
|
||||
getDictLabel(type, value) {
|
||||
if (value === undefined || value === null || value === "") {
|
||||
return "-"
|
||||
}
|
||||
const matched = normalizeOptions(dictData[type]).find((option) => String(option.value) === String(value))
|
||||
return matched ? matched.label : value
|
||||
}
|
||||
}
|
||||
6
RuoYi-Vue/tmp-logs/qing-ui-preview/src/utils/request.js
Normal file
6
RuoYi-Vue/tmp-logs/qing-ui-preview/src/utils/request.js
Normal file
@@ -0,0 +1,6 @@
|
||||
const page = { data: { records: [], total: 0 } }
|
||||
export default {
|
||||
get() { return Promise.resolve(page) },
|
||||
post(path) { return Promise.resolve(path === '/auth/login' ? { code: '200', data: { token: 'preview-token', user: { displayName: 'Preview User' } } } : { code: '200' }) },
|
||||
delete() { return Promise.resolve({ code: '200' }) }
|
||||
}
|
||||
Reference in New Issue
Block a user