hanmin0822 / MisakaTranslator

御坂翻译器—Galgame/文字游戏/漫画多语种实时机翻工具
GNU General Public License v3.0
4.96k stars 435 forks source link

人工翻译里没有保存机器翻译内容 #252

Open JeanYen opened 2 years ago

JeanYen commented 2 years ago

问题描述 开启人工翻译记录后sqlite文件里没有保存机器翻译内容,只有原文和人工翻译,并且导出文件或选择文件路径时会报错(系统无法找到指定的驱动器)

应用版本 2.11.0.0

系统信息 Windows11 x64

错误信息 ==============System Info================ System:Microsoft Windows NT 10.0.22000.0 CurrentTime:2022/9/12 8:01 dotNetVersion:4.0.30319.42000 MisakaTranslatorVersion:2.11.0.0 ==============Exception Info================ ExceptionType:Non UI Thread ExceptionName:System.ComponentModel.Win32Exception ExceptionSource:PresentationFramework ExceptionMessage:系统找不到指定的驱动器。 ExceptionStackTrace: 在 MS.Internal.AppModel.ShellUtil.GetShellItemForPath(String path) 在 Microsoft.Win32.FileDialog.PrepareVistaDialog(IFileDialog dialog) 在 Microsoft.Win32.FileDialog.RunVistaDialog(IntPtr hwndOwner) 在 Microsoft.Win32.FileDialog.RunDialog(IntPtr hwndOwner) 在 Microsoft.Win32.CommonDialog.ShowDialog() 在 MisakaTranslator_WPF.SettingsPages.ArtificialTransSettingsPage.ExportBtn_Click(Object sender, RoutedEventArgs e) 在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) 在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) 在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) 在 System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) 在 System.Windows.Controls.Primitives.ButtonBase.OnClick() 在 System.Windows.Controls.Button.OnClick() 在 System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) 在 System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e) 在 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) 在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) 在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) 在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) 在 System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) 在 System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) 在 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) 在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) 在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) 在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) 在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) 在 System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) 在 System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) 在 System.Windows.Input.InputManager.ProcessStagingArea() 在 System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) 在 System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) 在 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) 在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 在 System.Windows.Application.RunDispatcher(Object ignore) 在 System.Windows.Application.RunInternal(Window window) 在 System.Windows.Application.Run(Window window) 在 MisakaTranslator_WPF.App.Main()

anton2925 commented 1 year ago

同样有这问题,用了老版本反而有了机械翻译

anton2925 commented 1 year ago

试了好几次,突然同时用彩云和小牛时,有记录。 在经过测试时发现如果第一翻译时彩云时,记录会自动跳过,数据库会记录小牛的。

最后采用方案是小牛第一,彩云第二的方案。这样修改人工时,才会有变化。不然就都是小牛了

picaroup commented 1 year ago

+1 希望能修一下

picaroup commented 1 year ago

我翻了一下代码,这个默认会打开D盘,没有D盘会报错。大家做个D盘就好了

imba-tjd commented 1 year ago

异常 fixed in 81df60d70461a0d4101bbfa40b0f79609e23ed71

没保存翻译内容嘛,逻辑太复杂了,我也不用这功能。看其他人修吧

hayaxijason commented 8 months ago

我第一次接触C#, 翻了下代码,关于自动保存的文本为第二文本,而不是第一文本,我的猜测是: 在这里我们调用了2次TranslateApiSubmitASync 所以虽然第一次调用确实insert了翻译结果到DB,第二次调用产生的API翻译结果又重新insert了一遍,覆盖掉了第一次的。 Somehow 第二翻译源wins the race 先把翻译文本insert到DB中,所以之后第一翻译源想要insert的时候,发现record已经存在,就跳过了。 (仅为猜测,不足为Root Cause