Skip to content
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

Add google translate #777

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/Agnai.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/dataSources.local.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/prettier.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

421 changes: 421 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions common/dummy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function toBotMsg(
kind: 'chat-message',
msg,
retries: [],
translatedMsg: msg,
characterId: bot._id,
updatedAt: '',
...props,
Expand All @@ -90,6 +91,7 @@ export function toUserMsg(
kind: 'chat-message',
msg,
retries: [],
translatedMsg: msg,
userId: user.userId,
updatedAt: new Date().toISOString(),
...props,
Expand Down
4 changes: 4 additions & 0 deletions common/types/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type { TTSSettings, VoiceSettings } from './texttospeech-schema'
import { UISettings } from './ui'
import { FullSprite } from './sprite'
import { ModelFormat } from '../presets/templates'
import { TranslationSettings } from './translation-schema'

export type AllDoc =
| AppSchema.Announcement
Expand Down Expand Up @@ -232,6 +233,8 @@ export namespace AppSchema {
autoRecord: boolean
}

translation?: TranslationSettings

texttospeech?: TTSSettings

images?: ImageSettings
Expand Down Expand Up @@ -357,6 +360,7 @@ export namespace AppSchema {
chatId: string
msg: string
retries: string[]
translatedMsg: string
extras?: string[]
characterId?: string
userId?: string
Expand Down
19 changes: 19 additions & 0 deletions common/types/translation-schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type TranslationType = GoogleTranslate

export type TranslationService = 'googletranslate'

export type GoogleTranslate = {
type: 'googletranslate'
}

export type TranslateDirections =
| 'none'
| 'translate_both'
| 'translate_inputs'
| 'translate_responses'

export type TranslationSettings = {
type: TranslationType['type']
direction: TranslateDirections
targetLanguage: string
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"easy-speech": "^2.1.1",
"evtstore": "^12.0.1",
"express": "^4.18.2",
"google-translate-api-browser": "^3.0.1",
"gpt-3-encoder": "^1.1.4",
"jsonwebtoken": "^9.0.0",
"localtunnel": "^2.0.2",
Expand Down
Loading