Skip to content

Commit

Permalink
feat: Add translate AI language API
Browse files Browse the repository at this point in the history
  • Loading branch information
aXenDeveloper committed Dec 23, 2024
1 parent 04fdeeb commit c5cd000
Show file tree
Hide file tree
Showing 30 changed files with 184 additions and 410 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: pnpm run build:scripts

- name: Build Projects
run: pnpm run build --filter=vitnode-backend --filter=vitnode-frontend --filter=vitnode-backend-email-resend --filter=vitnode-backend-email-smtp --filter=vitnode-backend-ai-google --filter=vitnode-backend-ai-open-ai --filter=vitnode-shared
run: pnpm run build --filter=vitnode-backend --filter=vitnode-frontend --filter=vitnode-backend-email-resend --filter=vitnode-backend-email-smtp --filter=vitnode-shared

- name: Run script to bump version & copy files
if: github.event.inputs.skip_bump_version == 'false'
Expand Down Expand Up @@ -88,21 +88,21 @@ jobs:

- name: Publish canary
if: github.event.inputs.release == 'canary'
run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --filter vitnode-shared --tag canary --no-git-checks
run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --filter vitnode-shared --tag canary --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- name: Publish release candidate
if: github.event.inputs.release == 'release-candidate'
run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --filter vitnode-shared --tag rc --no-git-checks
run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --filter vitnode-shared --tag rc --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- name: Publish stable
if: github.event.inputs.release == 'stable'
run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --filter vitnode-shared --no-git-checks
run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --filter vitnode-shared --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
3 changes: 1 addition & 2 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"db": "vitnode-backend db"
},
"dependencies": {
"@ai-sdk/google": "^1.0.10",
"@nestjs/cache-manager": "3.0.0-next.0",
"@nestjs/common": "^10.4.15",
"@nestjs/core": "^10.4.15",
Expand All @@ -28,8 +29,6 @@
"react-dom": "^19.0.0",
"reflect-metadata": "^0.2.2",
"vitnode-backend": "workspace:*",
"vitnode-backend-ai-google": "workspace:*",
"vitnode-backend-ai-open-ai": "workspace:*",
"vitnode-backend-email-resend": "workspace:*",
"vitnode-backend-email-smtp": "workspace:*"
},
Expand Down
18 changes: 7 additions & 11 deletions apps/backend/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import { createGoogleGenerativeAI } from '@ai-sdk/google';
// import { emailSMTP } from 'vitnode-backend-email-smtp';
// import { aiGoogle } from 'vitnode-backend-ai-google';
// import { aiOpenAi } from 'vitnode-backend-ai-open-ai';
// import { emailResend } from 'vitnode-backend-email-resend';
import { CacheModule } from '@nestjs/cache-manager';
import { Module } from '@nestjs/common';
// import { emailResend } from 'vitnode-backend-email-resend';
import { VitNodeCoreModule } from 'vitnode-backend/app.module';

import { DATABASE_ENVS, schemaDatabase } from './database/config';
import { DatabaseModule } from './database/database.module';
import { PluginsModule } from './plugins/plugins.module';

const google = createGoogleGenerativeAI({
apiKey: process.env.AI_MODEL_API_KEY,
});

@Module({
imports: [
VitNodeCoreModule.register({
database: {
config: DATABASE_ENVS,
schemaDatabase,
},
ai: google('gemini-1.5-pro'),
// captcha: {
// type: 'cloudflare_turnstile',
// secret_key: '',
Expand All @@ -34,14 +38,6 @@ import { PluginsModule } from './plugins/plugins.module';
// password: process.env.EMAIL_SMTP_PASSWORD,
// from: process.env.EMAIL_SMTP_FROM,
// }),
// ai: aiGoogle({
// api_key: process.env.AI_GOOGLE_API_KEY,
// model: 'gemini-1.0-pro',
// }),
// ai: aiOpenAi({
// api_key: process.env.AI_OPENAI_API_KEY,
// model: 'gpt-4-turbo',
// }),
}),
DatabaseModule,
PluginsModule,
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/plugins/admin/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
}
},
"legal": {
"title": "Legal & Policies",
"title": "Legal",
"desc": "These settings are used to generate the legal pages on your website.",
"legal_public": "Public Legal",
"created": "Created",
Expand Down
2 changes: 0 additions & 2 deletions bump-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ const packages = [
'eslint-config-typescript-vitnode',
'backend-email-resend',
'backend-email-smtp',
'backend-ai-open-ai',
'backend-ai-google',
];

const getPackageJson = () => {
Expand Down
5 changes: 0 additions & 5 deletions packages/backend-ai-google/.npmignore

This file was deleted.

68 changes: 0 additions & 68 deletions packages/backend-ai-google/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions packages/backend-ai-google/eslint.config.mjs

This file was deleted.

37 changes: 0 additions & 37 deletions packages/backend-ai-google/package.json

This file was deleted.

22 changes: 0 additions & 22 deletions packages/backend-ai-google/src/index.ts

This file was deleted.

11 changes: 0 additions & 11 deletions packages/backend-ai-google/tsconfig.json

This file was deleted.

5 changes: 0 additions & 5 deletions packages/backend-ai-open-ai/.npmignore

This file was deleted.

68 changes: 0 additions & 68 deletions packages/backend-ai-open-ai/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions packages/backend-ai-open-ai/eslint.config.mjs

This file was deleted.

37 changes: 0 additions & 37 deletions packages/backend-ai-open-ai/package.json

This file was deleted.

Loading

0 comments on commit c5cd000

Please sign in to comment.