feat(prompt): enhance context and intent classification in templates
- Updated context template to include runtime metadata such as current time and week, improving contextual awareness in user queries. - Enhanced rewrite template with critical instructions for intent classification, ensuring that rewritten questions preserve essential entities and keywords. - Refined intent classification logic to prioritize user intents more effectively, improving the accuracy of responses based on user queries. - Added examples to clarify expected input and output formats for intent classification, enhancing usability for developers.
This commit is contained in:
@@ -136,12 +136,10 @@ const closePreImg = () => {
|
||||
// 创建自定义渲染器实例
|
||||
const customRenderer = new marked.Renderer();
|
||||
// 覆盖图片渲染方法
|
||||
customRenderer.image = function({href, title, text}) {
|
||||
// 验证图片 URL 是否安全
|
||||
customRenderer.image = function(href, title, text) {
|
||||
if (!isValidImageURL(href)) {
|
||||
return `<p>${t('error.invalidImageLink')}</p>`;
|
||||
}
|
||||
// 使用安全的图片创建函数
|
||||
return createSafeImage(href, text || '', title || '');
|
||||
};
|
||||
|
||||
|
||||
@@ -41,10 +41,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div style="min-height: 115px; margin: 16px auto 4px;width: 100%;max-width: 800px;">
|
||||
<InputField
|
||||
@send-msg="(query, modelId, mentionedItems, imageFiles) => sendMsg(query, modelId, mentionedItems, imageFiles)"
|
||||
<InputField
|
||||
ref="inputFieldRef"
|
||||
@send-msg="(query, modelId, mentionedItems, imageFiles) => sendMsg(query, modelId, mentionedItems, imageFiles)"
|
||||
@stop-generation="handleStopGeneration"
|
||||
:isReplying="isReplying"
|
||||
:isReplying="isReplying"
|
||||
:sessionId="session_id"
|
||||
:assistantMessageId="currentAssistantMessageId"
|
||||
></InputField>
|
||||
@@ -87,6 +88,7 @@ const route = useRoute();
|
||||
const router = useRouter();
|
||||
const session_id = ref(route.params.chatid);
|
||||
const sessionData = ref(null);
|
||||
const inputFieldRef = ref();
|
||||
const created_at = ref('');
|
||||
const limit = ref(20);
|
||||
const messagesList = reactive([]);
|
||||
@@ -139,8 +141,11 @@ const fetchSuggestedQuestions = async () => {
|
||||
};
|
||||
|
||||
const handleSuggestedQuestionClick = (question) => {
|
||||
// 触发发送消息
|
||||
sendMsg(question);
|
||||
if (inputFieldRef.value?.triggerSend) {
|
||||
inputFieldRef.value.triggerSend(question);
|
||||
} else {
|
||||
sendMsg(question);
|
||||
}
|
||||
};
|
||||
|
||||
// 防抖包装,切换知识库/文件时300ms内不重复请求
|
||||
|
||||
Reference in New Issue
Block a user