Browse Source

OA答辩优化

zhuliu 2 months ago
parent
commit
9fb3b050fe
2 changed files with 142 additions and 30 deletions
  1. 108 21
      src/views/AITools/OADefense/OADefense1.vue
  2. 34 9
      src/views/AITools/OADefense/mixins/index1.js

File diff suppressed because it is too large
+ 108 - 21
src/views/AITools/OADefense/OADefense1.vue


+ 34 - 9
src/views/AITools/OADefense/mixins/index1.js

@@ -1,4 +1,4 @@
-const api_key = 'app-NvKwdHvEK2UmJdmjTGDR0xu6'
+const api_key = 'app-NRQwVZmqF8a1yuhzgB96Ndj1'
 const url = 'http://192.168.2.24/v1'
 export default {
     data() {
@@ -37,13 +37,20 @@ export default {
             // var params = {
             //     inputs:{
             //         fileUrl:'http://192.168.2.24:8803/fileManager/downloadFile?fileId='+this.notice_file.guid,
-            //         patent_fileUrls:JSON.stringify(patent_fileUrls)
+            //         patent_fileUrls:JSON.stringify(patent_fileUrls),
+            //         patent_files:[],
+            //         changeClaim:this.changeClaim.changeClaim + '',
+            //         claim:this.changeClaim.claim,
+            //         near_index:this.changeClaim.near_index,
+            //         main_claim_reason:JSON.stringify(this.main_claim_reason)
             //     },
             //     query:'OA答辩',
             //     response_mode:'streaming',
             //     user:this.userinfo.id
             // }
             // this.loading = true
+            // this.loading_text = ''
+            // var loading_text = ''
             // this.result = null
             // const response = await fetch('https://ai.xsip.cn/v1/chat-messages', {
             //   method: 'POST',
@@ -59,7 +66,11 @@ export default {
                 confessionSessionId:this.currentConversation.id,
                 patentFileUrls:JSON.stringify(patent_fileUrls),
                 appFileGuid:this.relevant_file.app_file.guid,
-                modifyFileGuid:this.relevant_file.modify_file.guid
+                modifyFileGuid:this.relevant_file.modify_file.guid,
+                changeClaim:this.changeClaim.changeClaim + '',
+                claim:this.changeClaim.claim,
+                nearIndex:this.changeClaim.near_index,
+                mainClaimReason:JSON.stringify(this.main_claim_reason)
             }
             this.loading = true
             this.loading_text = ''
@@ -103,16 +114,24 @@ export default {
                                     this.$refs.errorTip.open(answer_json)
                                 }else if(answer_json.code == 200){
                                     this.queryConfessionSession(false,false,true) 
-                                }else if(answer_json.code == 1003){
+                                }else if(answer_json.code == 1003){//中间过程
                                     this.loading_text = answer_json.data
                                     loading_text = answer_json.data
+                                }else if(answer_json.code == 1002){//请求超时
+                                    this.result = answer_json
+                                }else if(answer_json.code == 201){//修改后的权利要求输出
+                                    this.result = answer_json
+                                    this.$set(this.changeClaim,'claim',answer_json.data)
+                                }else if(answer_json.code == 202){//区别技术特征
+                                    this.result = answer_json
+                                    this.$set(this,'main_claim_reason',answer_json.data)
                                 }
                             }catch(e){
                                 if(loading_text!=''){
                                     loading_text = ''
                                     this.loading_text = ''
                                 }
-                                this.result += answer;
+                                this.result += answer.replace(/\n|\\n|\\\n|\\\\n/g,'<br>');
                             }
                             
                         }else if(json.event == 'message_replace'){
@@ -135,20 +154,26 @@ export default {
                                             if(answer_json.code == 1001){//缺少专利文件
                                                 this.result = answer_json
                                                 this.$refs.errorTip.open(answer_json)
-                                            }else if(answer_json.code == 1001){//请求超时
+                                            }else if(answer_json.code == 1002){//请求超时
                                                 this.result = answer_json
                                             }else if(answer_json.code == 200){
                                                 this.queryConfessionSession(false,false,true) 
-                                            }else if(answer_json.code == 1003){
+                                            }else if(answer_json.code == 1003){//中间过程
                                                 this.loading_text = answer_json.data
                                                 loading_text = answer_json.data
+                                            }else if(answer_json.code == 201){//修改后的权利要求输出
+                                                this.result = answer_json
+                                                this.$set(this.changeClaim,'claim',answer_json.data)
+                                            }else if(answer_json.code == 202){//区别技术特征
+                                                this.result = answer_json
+                                                this.$set(this,'main_claim_reason',answer_json.data)
                                             }
                                         }catch(e){
                                             if(loading_text!=''){
                                                 loading_text = ''
                                                 this.loading_text = ''
                                             }
-                                            this.result += answer;
+                                            this.result += answer.replace(/\n|\\n|\\\n|\\\\n/g,'<br>');
                                         }
                                     }else if(json.event == 'message_replace'){
                                         this.result = json.answer
@@ -175,7 +200,7 @@ export default {
         },
         //格式化AI答复
         formateAIAnswer(chat){
-            let answer = chat.replace('null','')
+            let answer = chat.replace('null','').replace(/<br>/gi, '</p><p>').replace(/^<p>|<\/p>$/gi, '')
 
             // let regx1 = /<think>[\s\S]*<\/think>/g
             // let regx2 = /<details style="color:gray;background-color: #f8f8f8;padding: 8px;border-radius: 4px;" open> <summary> Thinking... <\/summary>[\s\S]*<\/details>/g