-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: Generate prompt #4012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Generate prompt #4012
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,6 +100,19 @@ | |
| </ModelSelect> | ||
| </el-form-item> | ||
| <el-form-item :label="$t('views.application.form.roleSettings.label')"> | ||
| <template #label> | ||
| <div class="flex-between"> | ||
| <span>{{ $t('views.application.form.roleSettings.label') }}</span> | ||
| <el-button | ||
| type="primary" | ||
| link | ||
| @click="handleGeneratePromptClick(applicationForm.model_id as string)" | ||
| :disabled="!applicationForm.model_id" | ||
| > | ||
| 生成 | ||
| </el-button> | ||
| </div> | ||
| </template> | ||
| <MdEditorMagnify | ||
| :title="$t('views.application.form.roleSettings.label')" | ||
| v-model="applicationForm.model_setting.system" | ||
|
|
@@ -545,6 +558,7 @@ | |
| </el-card> | ||
|
|
||
| <AIModeParamSettingDialog ref="AIModeParamSettingDialogRef" @refresh="refreshForm" /> | ||
| <GeneratePromptDialog @replace="replace " ref="GeneratePromptDialogRef" /> | ||
| <TTSModeParamSettingDialog ref="TTSModeParamSettingDialogRef" @refresh="refreshTTSForm" /> | ||
| <ParamSettingDialog ref="ParamSettingDialogRef" @refresh="refreshParam" /> | ||
| <AddKnowledgeDialog | ||
|
|
@@ -566,6 +580,7 @@ import { reactive, ref, onMounted, computed, onBeforeMount } from 'vue' | |
| import { useRoute, useRouter } from 'vue-router' | ||
| import { groupBy, set } from 'lodash' | ||
| import AIModeParamSettingDialog from './component/AIModeParamSettingDialog.vue' | ||
| import GeneratePromptDialog from './component/GeneratePrompt.vue' | ||
| import ParamSettingDialog from './component/ParamSettingDialog.vue' | ||
| import AddKnowledgeDialog from './component/AddKnowledgeDialog.vue' | ||
| import type { FormInstance, FormRules } from 'element-plus' | ||
|
|
@@ -587,7 +602,9 @@ const router = useRouter() | |
| const { | ||
| params: { id }, | ||
| } = route as any | ||
|
|
||
| const replace = (v: any) => { | ||
| applicationForm.value.model_setting.system=v | ||
| } | ||
| const apiType = computed(() => { | ||
| if (route.path.includes('resource-management')) { | ||
| return 'systemManage' | ||
|
|
@@ -615,6 +632,7 @@ const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDi | |
| const ReasoningParamSettingDialogRef = ref<InstanceType<typeof ReasoningParamSettingDialog>>() | ||
| const TTSModeParamSettingDialogRef = ref<InstanceType<typeof TTSModeParamSettingDialog>>() | ||
| const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>() | ||
| const GeneratePromptDialogRef = ref<InstanceType<typeof GeneratePromptDialog>>() | ||
|
|
||
| const applicationFormRef = ref<FormInstance>() | ||
| const AddKnowledgeDialogRef = ref() | ||
|
|
@@ -743,6 +761,15 @@ const openAIParamSettingDialog = () => { | |
| } | ||
| } | ||
|
|
||
| const openGeneratePromptDialog = (modelId: string) => { | ||
| GeneratePromptDialogRef.value?.open(modelId) | ||
| } | ||
|
|
||
| const handleGeneratePromptClick = (model_id:string) => { | ||
| openGeneratePromptDialog(model_id) | ||
| } | ||
|
|
||
|
|
||
| const openReasoningParamSettingDialog = () => { | ||
| ReasoningParamSettingDialogRef.value?.open(applicationForm.value.model_setting) | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided Vue component appears to be well-structured, but there are a few potential improvements that can be made:
Here's the revised version of your code with these suggestions applied: <template>
<el-form label-width="auto">
<!-- Existing form elements -->
<el-form-item :label="$t('views.application.form.roleSettings.label')">
<div class="flex-between">
<span>{{ $t('views.application.form.roleSettings.label') }}</span>
<el-button
type="primary"
link
@click="handleGeneratePromptClick(applicationForm.model_id as string)"
:disabled="!applicationForm.model_id"
>
生成
</el-button>
</div>
<!-- Rest of the form item content -->
</el-form-item>
<!-- Other form items -->
</el-form>
</template>
<script setup lang="ts">
// Import necessary dependencies
const apiType = computed(() => {
// Computed property logic
})
const routes = [
/** Route definitions */
]
onMounted(async () => {
// Code executed after mounting
})
</script>
<style scoped>
/* CSS styles */
.flex-between {
display: flex;
justify-content: space-between;
}
</style>Key Changes Made:
These changes should improve the overall readability and maintainability of the code while ensuring it still fulfills its intended functionality. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provided JavaScript code includes several improvements and optimizations:
Functionality Expansion:
generate_promptto handle the generation of optimization prompt words.Code Style Improvements:
=.{}in conditionals and loops.Error Handling:
Documentation:
open,generate_prompt) and variable names.Overall, this update enhances the code's functionality and maintainability while keeping it clean and well-documented.