diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 0962304..b9dcfe4 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -24,7 +24,7 @@ async function send(){const q=question.value.trim();if(!q||busy.value)return;mes function validUrl(value:string){try{if(value)new URL(value);return true}catch{return false}} async function save(){error.value='';notice.value='';if(!form.value.title.trim()||!form.value.content.trim()){error.value='请填写知识标题和正文。';return}if(!validUrl(form.value.source_url)){error.value='来源网址必须是有效的 http(s) 地址。';return}try{await createKnowledge({...form.value,title:form.value.title.trim(),content:form.value.content.trim(),...(form.value.source_url?{source_url:form.value.source_url}:{})});form.value={title:'',category:'旅游资源',content:'',source_url:''};showForm.value=false;notice.value='已保存为待审核条目,尚未进入检索索引。';await refresh()}catch(e){error.value=e instanceof Error?e.message:'保存失败'}} -