feat: 推理对话支持生成参数配置
设置面板新增 Temperature、Top P、Max Tokens 滑块,参数随对话请求实时下发,替换原先硬编码默认值。
This commit is contained in:
@@ -30,6 +30,9 @@ const task = ref<CompareTask | null>(null)
|
|||||||
const messages = ref<ChatMessage[]>([])
|
const messages = ref<ChatMessage[]>([])
|
||||||
const inputQuestion = ref('')
|
const inputQuestion = ref('')
|
||||||
const systemPrompt = ref('')
|
const systemPrompt = ref('')
|
||||||
|
const temperature = ref(0.7)
|
||||||
|
const top_p = ref(0.95)
|
||||||
|
const maxTokens = ref(2048)
|
||||||
const contentRef = ref<HTMLElement>()
|
const contentRef = ref<HTMLElement>()
|
||||||
/** 设置面板抽屉 */
|
/** 设置面板抽屉 */
|
||||||
const showSettings = ref(false)
|
const showSettings = ref(false)
|
||||||
@@ -104,8 +107,9 @@ async function handleSend() {
|
|||||||
model_path: '',
|
model_path: '',
|
||||||
system_prompt: systemPrompt.value,
|
system_prompt: systemPrompt.value,
|
||||||
user_question: question,
|
user_question: question,
|
||||||
temperature: 0.7,
|
temperature: temperature.value,
|
||||||
max_tokens: 2048,
|
top_p: top_p.value,
|
||||||
|
max_tokens: maxTokens.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 完成后同步最终内容
|
// 完成后同步最终内容
|
||||||
@@ -288,8 +292,21 @@ onMounted(loadTask)
|
|||||||
resize="none"
|
resize="none"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="Temperature (温度)">
|
||||||
|
<el-slider v-model="temperature" :min="0" :max="2" :step="0.1" show-input />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="Top P (核心采样)">
|
||||||
|
<el-slider v-model="top_p" :min="0" :max="1" :step="0.05" show-input />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="Max Tokens (最大生成长度)">
|
||||||
|
<el-slider v-model="maxTokens" :min="128" :max="8192" :step="128" show-input />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="danger" plain @click="handleNewChat" style="width: 100%">
|
<el-button type="danger" plain @click="handleNewChat" style="width: 100%; margin-top: 20px;">
|
||||||
<i class="fa fa-trash-o" style="margin-right: 4px" />清空当前对话
|
<i class="fa fa-trash-o" style="margin-right: 4px" />清空当前对话
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
Reference in New Issue
Block a user