-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
全体的なリファクタリング #152
全体的なリファクタリング #152
Conversation
This PR is linked to issue #150 |
### ウォークスルー
この変更は、HTMLコンテンツの解析に`htmlparser2`を使用するためのリファクタリングと、新しいデータベース操作関数や翻訳処理ロジックの追加を含みます。また、不要な関数やファイルの削除、インポートパスの修正も行われています。
### 変更点
| ファイル | 要約 |
| --- | --- |
| `web/app/feature/translate/functions/mutations.server.ts` | `getOrCreateSourceTextIdAndPageVersionSourceText` 関数が削除されました。 |
| `web/app/feature/translate/libs/translation.ts` | `translate`および`processTranslation`関数を含むファイル全体が削除されました。 |
| `web/app/feature/translate/libs/translationUtils.ts` | `extractNumberedElements`関数を`htmlparser2`を使用するようにリファクタリングしました。 |
| `web/app/features/translate/jobs/translate-job.server.ts` | `extractNumberedElements`関数の呼び出しから`title`引数が削除されました。 |
| `web/app/features/translate/lib/translation.ts` | `extractNumberedElements`関数をリファクタリングし、新しい翻訳プロセス管理関数群を追加しました。 |
| `web/app/features/translate/services/anthropic.ts`, `web/app/features/translate/services/openai.ts` | `generateSystemMessage`のインポートパスが変更されました。 |
| `web/app/features/translate/types.ts` | 新しい型 `NumberedElement` を追加しました。 |
| `web/app/features/translate/utils/extractTranslations.server.ts` | `extractTranslations`関数を追加しました。 |
| `web/app/features/translate/utils/splitNumberedElements.server.ts` | `splitNumberedElements`関数を追加しました。 |
| `web/app/libs/db/user.server.ts` | `getDbUser` 関数と `getOrCreateAIUser` 関数が削除されました。 | Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
"start": "remix-serve ./build/server/index.js", | ||
"typecheck": "tsc", | ||
"check": "bunx @biomejs/biome check --write .", | ||
"clear-queues": "tsx scripts/clear-queues.ts", | ||
"seed": "NODE_ENV=development prisma db seed" | ||
}, | ||
"prisma": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This review was outside of the patch, but no patch was found that overlapped with it. Original lines [4-4]
parseDocument
関数は非同期処理をサポートしていないため、大規模なHTMLコンテンツを扱う場合にパフォーマンスの問題が発生する可能性があります。非同期処理をサポートするライブラリを検討してください。
-import { parseDocument } from 'htmlparser2';
+import { parseDocument, Parser } from 'htmlparser2';
Closes #150
translateにまとめられていたhtml処理を分離
translateから既存の翻訳がある場合はスキップする機能を削除
routeのtranslateとfeatureのtranslateが名前が被っていたのでrouteをtranslatorに修正
Summary by CodeRabbit