bilingual_book_maker icon indicating copy to clipboard operation
bilingual_book_maker copied to clipboard

Feat&Refactor: Add Text Pattern and extract DI

Open DennySORA opened this issue 1 year ago • 17 comments

[What]

  • 增加了 TXT 模式。
    • 定義了一個名為 Text 的類別。
    • 匹配了原先的 EPUB。
  • 抽出 Interface 做出 DI 增加擴充性。
  • 增加了 typing 的部分。
  • 抽出 Interface 分為兩類:
    • Translate engine: 主要放翻譯引擎。
    • File engine: 主要放需要支援的檔案。

[TODO]

想將 requests 換成 async 的版本,已加速 request 。

[Issue]

我發現翻譯 text 的上下文連接不是很好,目前我都是換行後就送,大概有推薦幾行為一個段落嗎?

DennySORA avatar Mar 04 '23 14:03 DennySORA

@DennySORA 改动稍微有点大。。。能最小化一个可执行的么?

yihong0618 avatar Mar 04 '23 14:03 yihong0618

歡迎各種討論。

目前還有一些工作想做,尤其加入 async + Multi-process

DennySORA avatar Mar 04 '23 14:03 DennySORA

@yihong0618

主要是將 function and class 抽了出來,讓他比較乾淨。

邏輯幾乎沒什麼動。

DennySORA avatar Mar 04 '23 14:03 DennySORA

@DennySORA 稍微看了下,代码很漂亮,但需要 review 时间看看明天看可以么?

yihong0618 avatar Mar 04 '23 14:03 yihong0618

btw 非常感谢。

yihong0618 avatar Mar 04 '23 14:03 yihong0618

@DennySORA about TODO 换成 async 对大部分人用处不大,因为大部分人是没付费的,瓶颈是 openai 的 limit

yihong0618 avatar Mar 04 '23 14:03 yihong0618

@yihong0618

不急,我是擔心其他人在改的時候沒跟著我這版,之後要是真的 merged 之後會不好改。

但主要我希望能將 File engine 抽出來,以方便之後擴充新的文檔格式。

DennySORA avatar Mar 04 '23 14:03 DennySORA

@yihong0618

openai 的 limit 的確,但增加 synce 也可以方便之後的加速擴充,但這個不急,也能用 DI 來解決跟切換。

我有時間再來處理,但這個變更是蠻大的,因此可能需要比較多時間討論。

感謝您~

DennySORA avatar Mar 04 '23 14:03 DennySORA

@yihong0618

感覺是個很不錯的專案,能花時間來處理。

我在 TODO 那再多提幾個點子,到時候再來討論哪些適合,哪些不適合~

感謝~

DennySORA avatar Mar 04 '23 14:03 DennySORA

谢谢你才对,我这边事情有些多,这么好的 PR 可能不会今晚看了,抱歉抱歉。

yihong0618 avatar Mar 04 '23 14:03 yihong0618

image

QAQ 哪裡出問題了……

DennySORA avatar Mar 04 '23 14:03 DennySORA

看起来是 black 版本问题,这里我没放版本号应该自动最新版本

pip install -U black

yihong0618 avatar Mar 04 '23 14:03 yihong0618

真的,我 fixed 了。

DennySORA avatar Mar 04 '23 14:03 DennySORA

image

這個 error 應該是 cicd 沒加入 key 吧?

DennySORA avatar Mar 04 '23 14:03 DennySORA

image

這個 error 應該是 cicd 沒加入 key 吧?

加了,你可以看 CI 里绿的,不知道为啥这个 key 现在在 CI PR 里传不进来,我明天研究下。。。

yihong0618 avatar Mar 04 '23 14:03 yihong0618

@yihong0618 感謝大大,今天就先到這,大大先忙,得休息阿~~晚安~

DennySORA avatar Mar 04 '23 14:03 DennySORA

晚安~

yihong0618 avatar Mar 04 '23 15:03 yihong0618

@DennySORA code most ok for me? can you fix Conflicting and let us move on!

yihong0618 avatar Mar 05 '23 07:03 yihong0618

sorry, i am outside. i will fixed tonight, thank.

DennySORA avatar Mar 05 '23 10:03 DennySORA

@yihong0618 I fixed.

DennySORA avatar Mar 05 '23 11:03 DennySORA

@DennySORA can you add one simple txt file for test. its better after the copyright protection period

yihong0618 avatar Mar 05 '23 13:03 yihong0618

--model gpt3 image

'GPT3' object has no attribute 'current_key_index'

yihong0618 avatar Mar 05 '23 13:03 yihong0618

@DennySORA why close?

yihong0618 avatar Mar 05 '23 13:03 yihong0618

@yihong0618 Sorry, I'm a bit tired. I've made too many modifications, and every time I have to find the part of the code that needs to be changed from a large amount of code and then incorporate it into my code. This has happened too many times. Please allow me to withdraw from this maintenance project. I really appreciate your contributions and openness. Have a good time, and thank you very much.

DennySORA avatar Mar 05 '23 13:03 DennySORA

that's why I will merge your work first... image

and that's fine thanks for your work.

yihong0618 avatar Mar 05 '23 13:03 yihong0618

@yihong0618 I'm sorry for interrupting your work. You can merge the code now. Thanks, and have a good night.

DennySORA avatar Mar 05 '23 14:03 DennySORA

I can't since you close it, but that's ok. Thanks for your work.

yihong0618 avatar Mar 05 '23 14:03 yihong0618

@yihong0618 Oh Sorry...I mean is can merge #43. I deleted the forked repository because I forked it from another repository, which caused the version to become unsynchronized. I will fork the original repository and make changes based on it.

DennySORA avatar Mar 05 '23 14:03 DennySORA