Skip to content

Commit

Permalink
Add 'definitions' field to formValue and update generateDefinition fu…
Browse files Browse the repository at this point in the history
…nction to handle it. (#546)
  • Loading branch information
swuecho authored Sep 17, 2024
1 parent 75ddef0 commit 8a71d37
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/src/views/prompt/components/PromptCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ const formValue = ref({
role: '',
characteristics: [],
requirements: [],
process: []
process: [],
definitions: [],
})
const rules = {
Expand Down Expand Up @@ -117,13 +118,14 @@ const generateCharacteristics = () => {
}
const generateDefinition = () => {
if (formValue.value.length > 0) {
if (formValue.value.definitions.length > 0) {
let xml = ''
xml += ' <definitions>\n'
formValue.value.definitions.forEach(def => {
xml += ` <definition>\n <name>${def.key}</name>\n <value>${def.value}</value>\n </definition>\n`
})
xml += ' </definitions>\n'
return xml
} else {
return ''
}
Expand Down

0 comments on commit 8a71d37

Please sign in to comment.