-
Notifications
You must be signed in to change notification settings - Fork 47
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
Content source: auto-translation #557
base: main
Are you sure you want to change the base?
Conversation
|
sourceId: source.sourceId, | ||
compute: async (event, context) => { | ||
const output = | ||
event.type === 'content_compute_pages' |
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.
Use a switch + assertNever, so if we add an event type we will get an error. Or if for an unknown reason we pass an unexpected event at runtime.
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.
default
case maybe?
const translated = JSON.parse(result.choices[0].message.content!); | ||
return translated.input; | ||
} catch (error) { | ||
throw new ExposableError('Failed to translate content: ' + (error as Error).message); |
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.
We should support cause
in ExposableError
, not in this PR.
{ label: 'English', id: 'en' }, | ||
{ label: 'French', id: 'fr' }, | ||
{ label: 'German', id: 'de' }, | ||
{ label: 'Italian', id: 'it' }, | ||
{ label: 'Japanese', id: 'ja' }, | ||
{ label: 'Korean', id: 'ko' }, | ||
{ label: 'Portuguese', id: 'pt' }, | ||
{ label: 'Russian', id: 'ru' }, | ||
{ label: 'Spanish', id: 'es' }, |
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.
85 languages are supported by ChatGPT, let's add all of them! Why not restricting it to this list?
https://botpress.com/blog/list-of-languages-supported-by-chatgpt
No description provided.