perf: 📜️强化常识性检测数据结构优化
This commit is contained in:
parent
342e32f49f
commit
e8c18e6eb8
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,4 +6,7 @@ TestConsoleApp
|
||||
obj
|
||||
**/obj/Debug/**
|
||||
**/obj/Release/**
|
||||
**/obj/Test/**
|
||||
**/obj/Test/**
|
||||
**/**/obj/Debug/**
|
||||
**/**/obj/Release/**
|
||||
**/**/obj/Test/**
|
Binary file not shown.
@ -3,23 +3,16 @@ using AIProofread.core;
|
||||
using AIProofread.Model;
|
||||
using AIProofread.Util;
|
||||
using Microsoft.Office.Interop.Word;
|
||||
using Microsoft.Office.Tools.Word;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using Microsoft.Web.WebView2.WinForms;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI;
|
||||
using NPOI.SS.Formula;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using NPOI.XWPF.UserModel;
|
||||
using Org.BouncyCastle.Asn1.Crmf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using UtilLib;
|
||||
using Document = Microsoft.Office.Interop.Word.Document;
|
||||
@ -336,6 +329,17 @@ namespace AIProofread
|
||||
var documentInfo = documentId > 0 ? Globals.ThisAddIn.GetDocumentById(documentId) : Globals.ThisAddIn.ActiveDocument;
|
||||
|
||||
var doc = documentInfo.CurrentDocument;
|
||||
// 判断是否处理修订模式
|
||||
if (doc.TrackRevisions)
|
||||
{
|
||||
//data.Add("code", 1);
|
||||
//data.Add("message", "文档存在未处理的修订,请处理后再进行校对");
|
||||
var ret = MessageBox.Show("文档当前处于修订模式,是否关闭此模式?","提示",MessageBoxButtons.YesNo);
|
||||
if(ret == DialogResult.Yes)
|
||||
{
|
||||
doc.TrackRevisions = false;
|
||||
}
|
||||
}
|
||||
if (ShouldUpgradeForced())
|
||||
{
|
||||
data.Add("code", 2);
|
||||
|
@ -9,6 +9,30 @@ namespace AIProofread
|
||||
Test,
|
||||
Prod
|
||||
}
|
||||
|
||||
public class AppServer
|
||||
{
|
||||
/// <summary>
|
||||
/// 开发环境
|
||||
/// </summary>
|
||||
public const string DEV = "http://localhost:5173/";
|
||||
/// <summary>
|
||||
/// 测试环境
|
||||
/// </summary>
|
||||
public const string TEST = "http://gm2-plugin.zverse.group/";
|
||||
/// <summary>
|
||||
/// 果麦预发布-灰度
|
||||
/// </summary>
|
||||
public const string PRE = "https://pre-gm-plugin.gachafun.com/";
|
||||
/// <summary>
|
||||
/// 果麦生产
|
||||
/// </summary>
|
||||
public const string PROD = "https://gm-plugin.gachafun.com/";
|
||||
/// <summary>
|
||||
/// 果麦金融
|
||||
/// </summary>
|
||||
public const string GM_FN = "https://gm-plugin-fn.gachafun.com/";
|
||||
}
|
||||
public class Config
|
||||
{
|
||||
public static readonly string APP_NAME = "AI校对王";
|
||||
@ -23,15 +47,16 @@ namespace AIProofread
|
||||
/// </summary>
|
||||
public static readonly string TextBackgroundColor = "#E9DABB"; // e9dabb D6AA69
|
||||
public static string DeviceId = "";
|
||||
|
||||
#if DEBUG
|
||||
/// <summary>
|
||||
/// 网页访问地址
|
||||
/// </summary>
|
||||
public static string WEB_PATH = "http://localhost:5173/"; //pre-gm-plugin.gachafun.com localhost:5173 gm2-plugin.zverse.group
|
||||
public static string WEB_PATH = AppServer.DEV; //pre-gm-plugin.gachafun.com localhost:5173 gm2-plugin.zverse.group
|
||||
public static bool RUN_IN_DEBUG = true;
|
||||
public static AppEnvironment APP_ENV = AppEnvironment.Dev;
|
||||
#else
|
||||
public static string WEB_PATH = "https://gm-plugin.gachafun.com/"; // gm-plugin.gachafun.com pre-gm-plugin.gachafun.com
|
||||
public static string WEB_PATH = AppServer.PROD; // gm-plugin.gachafun.com pre-gm-plugin.gachafun.com
|
||||
public static bool RUN_IN_DEBUG = false;
|
||||
public static AppEnvironment APP_ENV = AppEnvironment.Prod;
|
||||
#endif
|
||||
|
@ -55,6 +55,7 @@
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "FormCommonsenseDetection";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "常识性检测";
|
||||
this.Load += new System.EventHandler(this.FormCommonsenseDetection_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.MainWebView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
@ -1,8 +1,8 @@
|
||||
using AIProofread.core;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using UtilLib;
|
||||
|
||||
namespace AIProofread.Controls
|
||||
@ -13,8 +13,7 @@ namespace AIProofread.Controls
|
||||
{
|
||||
private bool initialized = false;
|
||||
|
||||
private string action;
|
||||
private object data;
|
||||
private List<WebMessage> actions = new List<WebMessage>();
|
||||
|
||||
public FormCommonsenseDetection()
|
||||
{
|
||||
@ -45,17 +44,24 @@ namespace AIProofread.Controls
|
||||
return;
|
||||
}
|
||||
// 添加到队列
|
||||
this.action = action;
|
||||
this.data = data;
|
||||
actions.Add(new WebMessage(action, data));
|
||||
//this.action = action;
|
||||
//this.data = data;
|
||||
}
|
||||
|
||||
public void InitializationCompleted()
|
||||
{
|
||||
if (!this.initialized && !string.IsNullOrEmpty(this.action))
|
||||
if (!this.initialized && actions.Count > 0) // !string.IsNullOrEmpty(this.action)
|
||||
{
|
||||
SendToWeb(this.action, this.data);
|
||||
this.action = null;
|
||||
this.data = null;
|
||||
actions.ForEach(item =>
|
||||
{
|
||||
SendToWeb(item.Message, item.Data);
|
||||
});
|
||||
// clear
|
||||
actions.Clear();
|
||||
//SendToWeb(this.action, this.data);
|
||||
//this.action = null;
|
||||
//this.data = null;
|
||||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
|
@ -348,6 +348,9 @@ namespace AIProofread
|
||||
ActiveDocument = documentList.SetActiveDocument(CurrentWordApplication.ActiveDocument);
|
||||
ActiveDocument.CheckBtnStatus();
|
||||
CheckDocumentClosed(null, null);
|
||||
if (formCommonsenseDetection != null) {
|
||||
formCommonsenseDetection.SendMessageToWeb("document-change", null);
|
||||
}
|
||||
Logger.Log("Application_DocumentChange -- " + ActiveDocument.fileName);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,6 @@ namespace AIProofread
|
||||
// DocumentReader.ReadByVSTO(doc, Globals.ThisAddIn.Application, list);
|
||||
//}
|
||||
}
|
||||
|
||||
var map = new Dictionary<string, object>
|
||||
{
|
||||
{ "list", list },
|
||||
@ -79,7 +78,11 @@ namespace AIProofread
|
||||
if (bodyElement is XWPFParagraph p)
|
||||
{
|
||||
// 处理普通段落
|
||||
list.Add(new DocumentText(p.ParagraphText.Replace("\u0002", ""), paragraphNumber));
|
||||
var text = p.ParagraphText.Replace("\u0002", "");
|
||||
if(text.Trim().Length > 0)
|
||||
{
|
||||
list.Add(new DocumentText(text, paragraphNumber));
|
||||
}
|
||||
paragraphNumber++;
|
||||
}
|
||||
// table -- vsto对于每个单元格的分段也会有
|
||||
|
47
updater/Form1.Designer.cs
generated
47
updater/Form1.Designer.cs
generated
@ -35,24 +35,29 @@
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.IconClose = new System.Windows.Forms.PictureBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.panelLog = new System.Windows.Forms.Panel();
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.IconClose)).BeginInit();
|
||||
this.panelLog.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// LabelLog
|
||||
//
|
||||
this.LabelLog.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.LabelLog.Location = new System.Drawing.Point(40, 57);
|
||||
this.LabelLog.Font = new System.Drawing.Font("微软雅黑", 10F);
|
||||
this.LabelLog.Location = new System.Drawing.Point(2, 2);
|
||||
this.LabelLog.MaximumSize = new System.Drawing.Size(296, 0);
|
||||
this.LabelLog.MinimumSize = new System.Drawing.Size(296, 0);
|
||||
this.LabelLog.Name = "LabelLog";
|
||||
this.LabelLog.Size = new System.Drawing.Size(300, 71);
|
||||
this.LabelLog.Size = new System.Drawing.Size(296, 21);
|
||||
this.LabelLog.TabIndex = 0;
|
||||
this.LabelLog.Text = "正在检测。。。";
|
||||
this.LabelLog.Text = "版本检测中 ...";
|
||||
this.LabelLog.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.LabelLog.Click += new System.EventHandler(this.LabelLog_Click);
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
this.progressBar1.Location = new System.Drawing.Point(40, 136);
|
||||
this.progressBar1.Location = new System.Drawing.Point(40, 180);
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Size = new System.Drawing.Size(300, 14);
|
||||
this.progressBar1.TabIndex = 3;
|
||||
@ -64,7 +69,7 @@
|
||||
this.ButtonProcess.DefaultBack = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(160)))), ((int)(((byte)(99)))));
|
||||
this.ButtonProcess.Font = new System.Drawing.Font("微软雅黑", 10F);
|
||||
this.ButtonProcess.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.ButtonProcess.Location = new System.Drawing.Point(122, 158);
|
||||
this.ButtonProcess.Location = new System.Drawing.Point(122, 202);
|
||||
this.ButtonProcess.Name = "ButtonProcess";
|
||||
this.ButtonProcess.Radius = 4;
|
||||
this.ButtonProcess.Size = new System.Drawing.Size(136, 44);
|
||||
@ -107,19 +112,40 @@
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "温馨提示";
|
||||
//
|
||||
// panelLog
|
||||
//
|
||||
this.panelLog.AutoScroll = true;
|
||||
this.panelLog.Controls.Add(this.LabelLog);
|
||||
this.panelLog.Location = new System.Drawing.Point(40, 58);
|
||||
this.panelLog.Name = "panelLog";
|
||||
this.panelLog.Size = new System.Drawing.Size(300, 114);
|
||||
this.panelLog.TabIndex = 8;
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.richTextBox1.Location = new System.Drawing.Point(237, 149);
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.ReadOnly = true;
|
||||
this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
||||
this.richTextBox1.Size = new System.Drawing.Size(100, 96);
|
||||
this.richTextBox1.TabIndex = 9;
|
||||
this.richTextBox1.Text = "";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(380, 216);
|
||||
this.ClientSize = new System.Drawing.Size(380, 260);
|
||||
this.Controls.Add(this.richTextBox1);
|
||||
this.Controls.Add(this.panelLog);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.ButtonProcess);
|
||||
this.Controls.Add(this.progressBar1);
|
||||
this.Controls.Add(this.LabelLog);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(380, 216);
|
||||
this.MaximumSize = new System.Drawing.Size(380, 260);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(380, 216);
|
||||
this.Name = "Form1";
|
||||
@ -129,6 +155,7 @@
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.IconClose)).EndInit();
|
||||
this.panelLog.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -141,6 +168,8 @@
|
||||
private System.Windows.Forms.PictureBox IconClose;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Panel panelLog;
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,6 +159,7 @@ namespace updater
|
||||
| SecurityProtocolType.Tls11
|
||||
| SecurityProtocolType.Tls12;
|
||||
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(UpgradeInfoURI + "api/v1/common/download/version");
|
||||
httpWebRequest.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
|
||||
HttpWebResponse resp = (HttpWebResponse)httpWebRequest.GetResponse();
|
||||
// 获取响应内容
|
||||
if (resp.StatusCode == HttpStatusCode.OK)
|
||||
@ -174,18 +175,27 @@ namespace updater
|
||||
resp.Close();
|
||||
UpgradeModel update = JsonConvert.DeserializeObject<UpgradeModel>(updateSource);
|
||||
ProcessUpdate(update);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
LabelLog.Text = "获取更新信息失败,请稍后重试";
|
||||
}
|
||||
LabelLog.Text = "获取更新信息失败,请稍后重试";
|
||||
}
|
||||
|
||||
private void ProcessUpdate(UpgradeModel update)
|
||||
{
|
||||
this.upgradeInfo = update.Info;
|
||||
LabelLog.Text = update.Info.Message;
|
||||
//richTextBox1.Text
|
||||
richTextBox1.Text = update.Info.Message
|
||||
+ @"Com加载项勾选
|
||||
重新安装插件
|
||||
升级office或wps的版本
|
||||
注册表检测
|
||||
Com加载项勾选
|
||||
重新安装插件
|
||||
补充:无论windowS10或11。在安装插件时,需要先装wps在安装插件,在安装插件。否则菜单中不会显示校对王插件入口";
|
||||
|
||||
if (localVersion == null || update.Info.NeedUpgrade(localVersion.Version))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user