Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds an SQLite database to track translation history and introduces a new history command to view previous translation records while also enhancing the translate command to record translations automatically.
- Adds database functionality including schema initialization, insert, and listing capabilities.
- Implements and tests translation functions using both Google Translate and ChatGPT.
- Updates CLI commands (translate, history, merge, convert) and configuration to support the new history tracking feature.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/translator/translator_test.go | Adds tests for GoogleTranslate and unsupported errors. |
| pkg/translator/translator.go | Implements translation functions using external APIs. |
| pkg/logging/logging.go | Provides logger initialization and per-component configuration. |
| pkg/database/database_test.go | Tests for database insert and listing functionality. |
| pkg/database/database.go | Introduces SQLite schema and functions for subtitles. |
| main.go | Sets up the application entry point. |
| go.mod | Updates module dependencies and settings. |
| cmd/translate.go | Enhances translate command to include DB record insertion. |
| cmd/root.go | Configures CLI root commands and initializes configuration. |
| cmd/merge.go | Provides merge command to combine subtitles. |
| cmd/history.go | Adds new history command to display translation records. |
| cmd/convert.go | Provides subtitle conversion command. |
| README.md | Updates documentation to reflect new features. |
| } | ||
| if dbPath := viper.GetString("db_path"); dbPath != "" { | ||
| if db, err := database.Open(dbPath); err == nil { | ||
| _ = database.InsertSubtitle(db, in, lang, service) |
There was a problem hiding this comment.
[nitpick] Consider handling or logging the error returned from InsertSubtitle instead of silently discarding it, so that potential database write issues can be surfaced.
Suggested change
| _ = database.InsertSubtitle(db, in, lang, service) | |
| if err := database.InsertSubtitle(db, in, lang, service); err != nil { | |
| logger.Warnf("InsertSubtitle failed: %v", err) | |
| } |
ec73180 to
d9f63ee
Compare
Contributor
|
Issue closed via automated workflow. |
12 tasks
Contributor
|
Issue closed via automated workflow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
historycommand for viewing records--dboption and defaults in configTesting
go vet ./...go build ./...go test ./...https://chatgpt.com/codex/tasks/task_e_684309f9d9608321906671a4e5ff20e1