├── .env.example ├── .eslintrc.cjs ├── .gitignore ├── .npmrc ├── LICENSE ├── README.md ├── docs └── images │ ├── app-token-screenshot.png │ ├── edit.gif │ ├── follow-up.gif │ ├── logo.png │ ├── metadata.gif │ ├── query.gif │ ├── schema.gif │ ├── signing-secret-screenshot.png │ └── slack-bot-token-screenshot.png ├── nodemon.json ├── package-lock.json ├── package.json ├── postcss.config.js ├── src ├── agent │ ├── data-question-agent.ts │ └── types.ts ├── config │ └── loader.ts ├── datasource │ ├── datasource.ts │ ├── datasources │ │ ├── bigquery.ts │ │ ├── mysql.ts │ │ └── pgsql.ts │ ├── index.ts │ └── types.ts ├── index.ts ├── indexes │ ├── dummy-index.ts │ ├── embedding-vector-index.ts │ ├── index.ts │ ├── question-assumption-index.ts │ └── types.ts ├── openai │ └── openai.ts ├── slack │ ├── command.ts │ ├── event-handlers │ │ ├── app-mention.ts │ │ ├── cancel-assumptions-editing.ts │ │ ├── cancel-query-editing.ts │ │ ├── edit-assumptions.ts │ │ ├── edit-query.ts │ │ ├── run-edited-query.ts │ │ └── update-assumptions.ts │ ├── types.ts │ └── view │ │ └── blocks.ts ├── utils │ ├── logger.ts │ ├── result-builder.ts │ └── ssh-tunnel.ts └── web │ ├── components │ ├── Buttons │ │ └── SidebarActionButton │ │ │ ├── SidebarActionButton.tsx │ │ │ └── index.ts │ ├── Chat │ │ ├── AssistantChatMessage.tsx │ │ ├── Assumption.tsx │ │ ├── Chat.tsx │ │ ├── ChatInput.tsx │ │ ├── ChatLoader.tsx │ │ ├── ChatMessage.tsx │ │ ├── ErrorMessageDiv.tsx │ │ ├── Instruction.tsx │ │ ├── MemoizedChatMessage.tsx │ │ ├── ModelSelect.tsx │ │ ├── PluginSelect.tsx │ │ ├── PromptList.tsx │ │ ├── Query.tsx │ │ ├── Regenerate.tsx │ │ ├── SystemPrompt.tsx │ │ ├── Temperature.tsx │ │ └── VariableModal.tsx │ ├── Chatbar │ │ ├── Chatbar.context.tsx │ │ ├── Chatbar.state.tsx │ │ ├── Chatbar.tsx │ │ └── components │ │ │ ├── ChatFolders.tsx │ │ │ ├── ChatbarSettings.tsx │ │ │ ├── ClearConversations.tsx │ │ │ ├── Conversation.tsx │ │ │ ├── Conversations.tsx │ │ │ └── PluginKeys.tsx │ ├── Folder │ │ ├── Folder.tsx │ │ └── index.ts │ ├── Markdown │ │ └── CodeBlock.tsx │ ├── Mobile │ │ └── Navbar.tsx │ ├── Promptbar │ │ ├── PromptBar.context.tsx │ │ ├── Promptbar.state.tsx │ │ ├── Promptbar.tsx │ │ ├── components │ │ │ ├── Prompt.tsx │ │ │ ├── PromptFolders.tsx │ │ │ ├── PromptModal.tsx │ │ │ ├── PromptbarSettings.tsx │ │ │ └── Prompts.tsx │ │ └── index.ts │ ├── Schemas │ │ └── SchemasDialog.tsx │ ├── Search │ │ ├── Search.tsx │ │ └── index.ts │ ├── Settings │ │ ├── Import.tsx │ │ ├── Key.tsx │ │ └── SettingDialog.tsx │ ├── Sidebar │ │ ├── Sidebar.tsx │ │ ├── SidebarButton.tsx │ │ ├── components │ │ │ └── OpenCloseButton.tsx │ │ └── index.ts │ └── Spinner │ │ ├── Spinner.tsx │ │ └── index.ts │ ├── hooks │ ├── useCreateReducer.ts │ └── useFetch.ts │ ├── next-env.d.ts │ ├── next.config.js │ ├── pages │ ├── _app.tsx │ ├── _document.tsx │ ├── _error.js │ ├── api │ │ ├── chat.ts │ │ ├── dsensei │ │ │ ├── answer.ts │ │ │ ├── run-query.ts │ │ │ └── schemas.ts │ │ ├── google.ts │ │ ├── home │ │ │ ├── home.context.tsx │ │ │ ├── home.state.tsx │ │ │ ├── home.tsx │ │ │ └── index.ts │ │ └── models.ts │ └── index.tsx │ ├── public │ ├── favicon.ico │ ├── locales │ │ ├── ar │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── bn │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── ca │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ └── sidebar.json │ │ ├── de │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── en │ │ │ └── common.json │ │ ├── es │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── fi │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── fr │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── he │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── id │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── it │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── ja │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── ko │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── pl │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── pt │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── ro │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── ru │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── si │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── sv │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── te │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ ├── tr │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ └── sidebar.json │ │ ├── vi │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ │ └── zh │ │ │ ├── chat.json │ │ │ ├── common.json │ │ │ ├── markdown.json │ │ │ ├── promptbar.json │ │ │ ├── settings.json │ │ │ └── sidebar.json │ ├── screenshot.png │ └── screenshots │ │ └── screenshot-0402023.jpg │ ├── services │ └── useApiService.ts │ ├── styles │ ├── Home.module.css │ └── globals.css │ ├── tsconfig.json │ ├── types │ ├── chat.ts │ ├── data.ts │ ├── env.ts │ ├── error.ts │ ├── export.ts │ ├── folder.ts │ ├── google.ts │ ├── index.ts │ ├── openai.ts │ ├── plugin.ts │ ├── prompt.ts │ ├── query.ts │ ├── settings.ts │ └── storage.ts │ └── utils │ ├── app │ ├── api.ts │ ├── clean.ts │ ├── codeblock.ts │ ├── const.ts │ ├── conversation.ts │ ├── folders.ts │ ├── importExport.ts │ ├── prompts.ts │ └── settings.ts │ ├── data │ └── throttle.ts │ └── server │ ├── google.ts │ └── index.ts ├── tailwind.config.js └── tsconfig.json /.env.example: -------------------------------------------------------------------------------- 1 | SLACK_BOT_TOKEN=YOUR_SLACK_BOT_TOKEN 2 | SLACK_SIGNING_SECRET=YOUR_SLACK_SIGNING_SECRET 3 | SLACK_APP_TOKEN=YOUR_SLACK_APP_TOKEN 4 | OPENAI_API_KEY=YOUR_OPENAI_API_KEY 5 | CONTEXT_FILE_PATH=YOUR_CONTEXT_FILE_PATH # File for you to provide more context to the bot 6 | 7 | # DISABLE_SCHEMA_ENRICHMENT=true 8 | 9 | # BigQuery 10 | # BQ_KEY=path/to/key.json 11 | 12 | # MySQL 13 | # DB_CONNECTION=mysql://username:password@127.0.0.1:3306/dbname 14 | 15 | # PgSQL 16 | # DB_CONNECTION=postgresql://username:password@localhost:5432/dbname 17 | 18 | # Optional, if you want to whitelist specific databases and tables 19 | # DATABASES=sample_database1,sample_database2 20 | # TABLES=sample_database1.sample_table1,sample_database1.sample_table2 21 | 22 | # Optionals for SSH Tunnel 23 | # Think about it will establish the ssh tunnel as below: 24 | # ssh -L [SSH_TUNNEL_SOURCE_PORT]:[SSH_TUNNEL_DESTINATION_IP]:[SSH_TUNNEL_DESTINATION_PORT] [SSH_TUNNEL_USERNAME]@[SSH_TUNNEL_REMOTE_HOST_ADDRESS] -p [SSH_TUNNEL_REMOTE_HOST_PORT] 25 | # SSH_TUNNEL_ENABLE=true 26 | # SSH_TUNNEL_REMOTE_HOST_ADDRESS=localhost 27 | # This is optional, default to 22 28 | # SSH_TUNNEL_REMOTE_HOST_PORT=2222 29 | # SSH_TUNNEL_USERNAME=username 30 | # One of the following option must be provide for auth, currently we support password or private key 31 | # SSH_TUNNEL_PASSWORD=password 32 | # SSH_TUNNEL_PRIVATE_KEY="-----BEGIN OPENSSH PRIVATE KEY----- 33 | #.... 34 | #.... 35 | #-----END OPENSSH PRIVATE KEY-----" 36 | # SSH_TUNNEL_DESTINATION_IP=127.0.0.1 37 | # SSH_TUNNEL_DESTINATION_PORT=5432 38 | # SSH_TUNNEL_SOURCE_PORT=5432 39 | -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | node: true, 4 | es2021: true 5 | }, 6 | extends: ['plugin:@next/next/recommended', 'standard-with-typescript'], 7 | overrides: [ 8 | ], 9 | ignorePatterns: [ 10 | 'src/components/**/*', 11 | './next-env.d.ts' 12 | ], 13 | parserOptions: { 14 | ecmaVersion: 'latest', 15 | parser: '@typescript-eslint/parser', 16 | sourceType: 'module', 17 | project: [ 18 | './tsconfig.json', 19 | './src/web/tsconfig.json' 20 | ] 21 | }, 22 | rules: { 23 | semi: 'off', 24 | '@typescript-eslint/semi': 'off', 25 | 'space-before-function-paren': 'off', 26 | '@typescript-eslint/space-before-function-paren': 'off', 27 | '@typescript-eslint/no-non-null-assertion': 'off', 28 | '@typescript-eslint/no-non-null-asserted-optional-chain': 'off', 29 | '@typescript-eslint/restrict-template-expressions': 'off', 30 | '@typescript-eslint/strict-boolean-expressions': 'off', 31 | '@typescript-eslint/prefer-nullish-coalescing': 'off', 32 | '@typescript-eslint/explicit-function-return-type': 'off', 33 | '@typescript-eslint/restrict-plus-operands': 'off', 34 | '@typescript-eslint/no-empty-interface': 'off', 35 | 'no-unused-vars': 'off', 36 | '@typescript-eslint/no-misused-promises': 'off', 37 | 'unused-imports/no-unused-imports': 'error', 38 | 'unused-imports/no-unused-vars': [ 39 | 'warn', 40 | { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' } 41 | ] 42 | }, 43 | plugins: ['unused-imports'] 44 | }; 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | *.swp 10 | 11 | pids 12 | logs 13 | results 14 | tmp 15 | 16 | # Build 17 | public/css/main.css 18 | tsconfig.tsbuildinfo 19 | 20 | # Coverage reports 21 | coverage 22 | 23 | # API keys and secrets 24 | .env 25 | 26 | # Dependency directory 27 | node_modules 28 | bower_components 29 | 30 | # Editors 31 | .idea 32 | *.iml 33 | 34 | # OS metadata 35 | .DS_Store 36 | Thumbs.db 37 | 38 | # Ignore built ts files 39 | dist/**/* 40 | 41 | # ignore yarn.lock 42 | yarn.lock 43 | keys/**/* 44 | 45 | src/web/.next/**/* 46 | .next/**/* 47 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # .npmrc 2 | engine-strict=true -------------------------------------------------------------------------------- /docs/images/app-token-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/docs/images/app-token-screenshot.png -------------------------------------------------------------------------------- /docs/images/edit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/docs/images/edit.gif -------------------------------------------------------------------------------- /docs/images/follow-up.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/docs/images/follow-up.gif -------------------------------------------------------------------------------- /docs/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/docs/images/logo.png -------------------------------------------------------------------------------- /docs/images/metadata.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/docs/images/metadata.gif -------------------------------------------------------------------------------- /docs/images/query.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/docs/images/query.gif -------------------------------------------------------------------------------- /docs/images/schema.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/docs/images/schema.gif -------------------------------------------------------------------------------- /docs/images/signing-secret-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/docs/images/signing-secret-screenshot.png -------------------------------------------------------------------------------- /docs/images/slack-bot-token-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/docs/images/slack-bot-token-screenshot.png -------------------------------------------------------------------------------- /nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src/**/*.ts"], 3 | "exec": "ts-node-esm --project tsconfig.json -r dotenv/config src/index.ts", 4 | "ext": "js ts" 5 | } 6 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {} 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /src/agent/types.ts: -------------------------------------------------------------------------------- 1 | import { type Row } from '../utils/result-builder.js'; 2 | 3 | export interface Answer { 4 | query: string 5 | hasResult: boolean 6 | err?: string 7 | rows?: Row[] 8 | assumptions?: string 9 | answer?: string 10 | } 11 | 12 | export interface Viz { 13 | image?: Buffer 14 | hasResult: boolean 15 | } 16 | -------------------------------------------------------------------------------- /src/config/loader.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs'; 2 | 3 | class ConfigLoader { 4 | private readonly bqkey: string | null = null; 5 | private readonly additionalContext: string | null = null; 6 | 7 | constructor() { 8 | this.bqkey = null; 9 | const envBqKey = process.env.BQ_KEY; 10 | if (envBqKey != null) { 11 | if (!fs.existsSync(envBqKey)) { 12 | throw new Error(`Bigquery key file "${envBqKey}" not found`); 13 | } 14 | 15 | this.bqkey = fs.readFileSync(envBqKey, { encoding: 'utf-8' }); 16 | } 17 | 18 | const contextFilePath = process.env.CONTEXT_FILE_PATH; 19 | if (contextFilePath != null) { 20 | if (!fs.existsSync(contextFilePath)) { 21 | throw new Error(`Context file "${contextFilePath}" not found`); 22 | } 23 | 24 | this.additionalContext = fs.readFileSync(contextFilePath, { encoding: 'utf-8' }); 25 | } 26 | } 27 | 28 | public getBqKey(): string | null { 29 | return this.bqkey; 30 | } 31 | 32 | public getAdditionalContext(): string | null { 33 | return this.additionalContext; 34 | } 35 | } 36 | 37 | const configLoader = new ConfigLoader(); 38 | export default configLoader; 39 | -------------------------------------------------------------------------------- /src/datasource/datasources/mysql.ts: -------------------------------------------------------------------------------- 1 | import knex, { type Knex } from 'knex'; 2 | import { DataSource } from '../datasource'; 3 | import { DataSourceType, type TableInfo, TableSchema } from '../types'; 4 | import { type Row } from '../../utils/result-builder'; 5 | import { type Answer } from '../../agent/types'; 6 | 7 | export default class MysqlSource extends DataSource { 8 | private connection!: Knex; 9 | 10 | public readonly dataSourceType = DataSourceType.Mysql; 11 | 12 | constructor(connectionString: string, allowedDatabases: string[], allowedTables: string[]) { 13 | super('MySQL', connectionString, allowedDatabases, allowedTables); 14 | } 15 | 16 | protected init(connectionString: string): void { 17 | this.connection = knex({ 18 | client: 'mysql', 19 | connection: connectionString 20 | }); 21 | } 22 | 23 | public async runQuery(query: string): Promise { 24 | const queryResult = await this.connection.raw(query); 25 | 26 | return { 27 | query, 28 | hasResult: true, 29 | rows: queryResult[0] 30 | }; 31 | } 32 | 33 | protected async loadDatabaseNames(): Promise { 34 | const result = await this.connection.raw('SHOW DATABASES'); 35 | return result[0] 36 | .map((row: { Database: string }) => row.Database) 37 | .filter( 38 | (database: string) => 39 | database !== 'information_schema' && 40 | database !== 'mysql' && 41 | database !== 'performance_schema' && 42 | database !== 'sys' 43 | ); 44 | } 45 | 46 | protected async loadTableNames(database: string): Promise { 47 | const result = await this.connection.raw(`SHOW TABLES FROM ${database}`); 48 | const key = `Tables_in_${database}`; 49 | return result[0].map((row: any) => row[key]); 50 | } 51 | 52 | protected async loadTableSchema(database: string, table: TableInfo): Promise { 53 | const rows = await this.connection.raw(`DESCRIBE ${database}.${table.name}`); 54 | 55 | const fields = rows[0].map((row: any) => ({ 56 | name: row.Field, 57 | description: '', 58 | type: row.Type, 59 | required: row.Null === 'NO' 60 | })); 61 | 62 | return new TableSchema( 63 | table.name, 64 | database, 65 | '', 66 | fields, 67 | DataSourceType.Mysql, 68 | '' 69 | ); 70 | } 71 | 72 | public async getRawSchema(database: string, table: string): Promise { 73 | const rows = await this.connection.raw(`DESCRIBE ${database}.${table}`); 74 | return rows[0].map((row: any) => { 75 | return { 76 | Name: row.Field, 77 | 'Data Type': row.Type, 78 | Default: row.Default 79 | }; 80 | }); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/datasource/datasources/pgsql.ts: -------------------------------------------------------------------------------- 1 | import knex, { type Knex } from 'knex'; 2 | import { DataSource } from '../datasource'; 3 | import { DataSourceType, type TableInfo, TableSchema } from '../types'; 4 | import { type Answer } from '../../agent/types'; 5 | import { type Row } from '../../utils/result-builder'; 6 | 7 | export class PgsqlSource extends DataSource { 8 | private connection!: Knex; 9 | 10 | public readonly dataSourceType = DataSourceType.PostgresSQL; 11 | 12 | constructor(connectionString: string, allowedDatabases: string[], allowedTables: string[]) { 13 | super('PostgresSQL', connectionString, allowedDatabases, allowedTables); 14 | } 15 | 16 | protected init(connectionString: string): void { 17 | this.logger.info(`Connecting to ${connectionString}...`); 18 | this.connection = knex({ 19 | client: 'postgresql', 20 | connection: connectionString 21 | }); 22 | } 23 | 24 | public async runQuery(query: string): Promise { 25 | const queryResult = await this.connection.raw(query); 26 | 27 | return { 28 | query, 29 | hasResult: true, 30 | rows: queryResult.rows 31 | }; 32 | } 33 | 34 | protected async loadDatabaseNames(): Promise { 35 | return [this.connection.client.database()]; 36 | } 37 | 38 | protected async loadTableNames(_: string): Promise { 39 | const result = await this.connection.raw( 40 | 'SELECT table_name FROM information_schema.tables WHERE table_schema = \'public\' AND table_type = \'BASE TABLE\';' 41 | ); 42 | return result.rows.map((row: any) => row.table_name); 43 | } 44 | 45 | protected async loadTableSchema(database: string, table: TableInfo): Promise { 46 | const rows = await this.connection.raw( 47 | `SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_name = '${table.name}'` 48 | ); 49 | 50 | const fields = rows.rows.map((row: any) => ({ 51 | name: row.column_name, 52 | description: '', 53 | type: row.data_type, 54 | required: row.is_nullable === 'NO' 55 | })); 56 | 57 | return new TableSchema( 58 | table.name, 59 | database, 60 | '', 61 | fields, 62 | DataSourceType.PostgresSQL, 63 | '' 64 | ); 65 | } 66 | 67 | protected includeDatabaseNameInQuery(): boolean { 68 | return false; 69 | } 70 | 71 | public async getRawSchema(database: string, table: string): Promise { 72 | const rows = await this.connection.raw( 73 | `SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_name = '${table}'` 74 | ); 75 | 76 | return rows.rows.map((row: any) => { 77 | return { 78 | column_name: row.column_name, 79 | data_type: row.data_type, 80 | is_nullable: row.is_nullable 81 | }; 82 | }); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/datasource/index.ts: -------------------------------------------------------------------------------- 1 | import configLoader from '../config/loader'; 2 | import getLogger from '../utils/logger'; 3 | import { type DataSource } from './datasource'; 4 | import BigQuerySource from './datasources/bigquery'; 5 | import MysqlSource from './datasources/mysql'; 6 | import { PgsqlSource } from './datasources/pgsql'; 7 | 8 | const logger = getLogger('DataSourceLoader'); 9 | function loadDataSource(): DataSource { 10 | if (configLoader.getBqKey() == null && process.env.DB_CONNECTION == null) { 11 | throw new Error('Neither of BQ_KEY and DB_CONNECTION are set. Please set only one of them.'); 12 | } 13 | 14 | const databases = process.env.DATABASES != null ? process.env.DATABASES.split(',') : []; 15 | const tables = process.env.TABLES != null ? process.env.TABLES.split(',') : []; 16 | 17 | const invalidTables = tables.filter(table => !table.includes('.')); 18 | if (invalidTables.length > 0) { 19 | throw new Error(`Invalid whitelist table: ${invalidTables.join(', ')}. Please make sure the whitelisted table names include the database name with format {database_name|dataset_name}.{table_name}.`); 20 | } 21 | 22 | let dataSource: DataSource; 23 | if (process.env.DB_CONNECTION != null) { 24 | if (process.env.DB_CONNECTION.startsWith('mysql')) { 25 | dataSource = new MysqlSource(process.env.DB_CONNECTION!, databases, tables); 26 | } else if (process.env.DB_CONNECTION.startsWith('pgsql') || process.env.DB_CONNECTION.startsWith('postgres')) { 27 | dataSource = new PgsqlSource(process.env.DB_CONNECTION!, databases, tables); 28 | } else { 29 | throw new Error('Unsupported DB_CONNECTION: ' + process.env.DB_CONNECTION); 30 | } 31 | } else { 32 | dataSource = new BigQuerySource(configLoader.getBqKey()!, databases, tables); 33 | } 34 | 35 | logger.info(`Use data source from ${dataSource.dataSourceType}`); 36 | return dataSource; 37 | } 38 | 39 | const dataSource = loadDataSource(); 40 | export default dataSource; 41 | -------------------------------------------------------------------------------- /src/indexes/dummy-index.ts: -------------------------------------------------------------------------------- 1 | import { type DataSource } from '../datasource/datasource'; 2 | import type DataSourceContextIndex from './types'; 3 | 4 | export default class DummyIndex implements DataSourceContextIndex { 5 | private readonly store: string[] = []; 6 | 7 | constructor(source: DataSource) { 8 | void source.getInitializationPromise().then(async () => { 9 | const tableSchemas = source.getTables(); 10 | 11 | this.store.push(...tableSchemas.map(schema => schema.getUniqueID())); 12 | }); 13 | } 14 | 15 | async search(_: string): Promise { 16 | return this.store; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/indexes/embedding-vector-index.ts: -------------------------------------------------------------------------------- 1 | import { MemoryVectorStore } from 'langchain/vectorstores/memory'; 2 | import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; 3 | import { type DataSource } from '../datasource/datasource'; 4 | import getLogger from '../utils/logger'; 5 | import { type Document } from 'langchain/document'; 6 | import type DataSourceContextIndex from './types'; 7 | 8 | const logger = getLogger('DataSourceContextIndex'); 9 | 10 | export default class EmbeddingVectorIndex implements DataSourceContextIndex { 11 | private store!: MemoryVectorStore; 12 | 13 | constructor(source: DataSource) { 14 | void source.getInitializationPromise().then(async () => { 15 | const tableSchemas = source.getTables(); 16 | 17 | logger.info('Building embedding vector index.'); 18 | this.store = await MemoryVectorStore.fromTexts( 19 | tableSchemas.map(schema => JSON.stringify(schema.getColumnNames())), 20 | tableSchemas.map(schema => ({ id: schema.getUniqueID() })), 21 | new OpenAIEmbeddings() 22 | ); 23 | 24 | logger.info(`Finished loading embedding vector index for ${this.store.memoryVectors.length} tables.`); 25 | }); 26 | } 27 | 28 | async search(query: string): Promise { 29 | const results = await this.store.similaritySearchWithScore(query, 10); 30 | logger.debug(`Data source context index search result: ${JSON.stringify(results)}`); 31 | return results.map(([result, score]) => (result as Document).metadata.id); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/indexes/index.ts: -------------------------------------------------------------------------------- 1 | import dataSource from '../datasource'; 2 | import { type DataSource } from '../datasource/datasource' 3 | import DummyIndex from './dummy-index'; 4 | import EmbeddingVectorIndex from './embedding-vector-index' 5 | import type DataSourceContextIndex from './types'; 6 | 7 | function buildDataSourceContextIndex(useEmbeddingVectorIndex: boolean, dataSource: DataSource): DataSourceContextIndex { 8 | if (useEmbeddingVectorIndex) { 9 | return new EmbeddingVectorIndex(dataSource); 10 | } 11 | 12 | return new DummyIndex(dataSource); 13 | } 14 | 15 | const dataSourceContextIndex = buildDataSourceContextIndex(Boolean(process.env.ENABLE_EMBEDDING_INDEX), dataSource); 16 | 17 | export default dataSourceContextIndex; 18 | -------------------------------------------------------------------------------- /src/indexes/question-assumption-index.ts: -------------------------------------------------------------------------------- 1 | import { MemoryVectorStore } from 'langchain/vectorstores/memory'; 2 | import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; 3 | import getLogger from '../utils/logger'; 4 | import { Document } from 'langchain/document'; 5 | 6 | const logger = getLogger('QuestionAssumptionIndex'); 7 | 8 | export default class QuestionAssumptionIndex { 9 | private readonly store: MemoryVectorStore; 10 | 11 | constructor() { 12 | this.store = new MemoryVectorStore(new OpenAIEmbeddings()); 13 | } 14 | 15 | async add(question: string, assumptions: string): Promise { 16 | await this.store.addDocuments([ 17 | new Document({ 18 | pageContent: 19 | JSON.stringify({ 20 | question, 21 | assumptions 22 | }), 23 | metadata: { 24 | id: question 25 | } 26 | }) 27 | ]); 28 | } 29 | 30 | async search(query: string): Promise { 31 | const results = await this.store.similaritySearchWithScore(query, 5); 32 | logger.debug(`Data source context index search result: ${JSON.stringify(results)}`); 33 | return results.map(([result, score]) => (result as Document).pageContent); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/indexes/types.ts: -------------------------------------------------------------------------------- 1 | export default interface DataSourceContextIndex { 2 | search: (query: string) => Promise 3 | } 4 | -------------------------------------------------------------------------------- /src/openai/openai.ts: -------------------------------------------------------------------------------- 1 | import * as ChatGPT from '@logunify/chatgpt'; 2 | 3 | class OpenAI { 4 | private readonly api: ChatGPT.ChatGPTAPI; 5 | 6 | constructor() { 7 | this.api = new ChatGPT.ChatGPTAPI({ 8 | apiKey: process.env.OPENAI_API_KEY!, 9 | completionParams: { 10 | temperature: 0 11 | } 12 | }); 13 | } 14 | 15 | async sendMessage(message: string, parentMessageId: string | undefined = undefined): Promise { 16 | const response = await this.api.sendMessage(message, { parentMessageId }); 17 | return response; 18 | } 19 | } 20 | 21 | const openAI = new OpenAI(); 22 | export default openAI; 23 | -------------------------------------------------------------------------------- /src/slack/command.ts: -------------------------------------------------------------------------------- 1 | import { type App } from '@slack/bolt'; 2 | import getLogger from '../utils/logger'; 3 | import { type DataSource } from '../datasource/datasource'; 4 | import ResultBuilder from '../utils/result-builder'; 5 | 6 | const logger = getLogger('Command Handler'); 7 | 8 | export default async function handlCommand(app: App, source: DataSource): Promise { 9 | app.command('/info', async ({ command, ack, say }) => { 10 | try { 11 | logger.info('Received app_mention event'); 12 | 13 | if (command.text.startsWith('dbs')) { 14 | logger.info('dbs command'); 15 | const dbs = source.getDatabases().map((db) => db.name); 16 | logger.info(`dbs: ${dbs.join('\n')}`); 17 | await say({ 18 | text: '```' + 'Your databases: \n--------------------\n' + dbs.join('\n') + '```' 19 | }); 20 | } else if (command.text.startsWith('tables')) { 21 | const db = command.text.split(' ')[1]; 22 | logger.info(`tables command for ${db}`); 23 | const tables = source 24 | .getDatabases() 25 | .find((d) => d.name === db) 26 | ?.schemas.map((schema) => schema.name); 27 | if (tables == null) { 28 | void say({ 29 | text: `Database ${db} not found or there are no tables in it` 30 | }); 31 | return; 32 | } else { 33 | await say({ 34 | text: '```' + `Your tables in ${db}: \n--------------------\n` + tables.join('\n') + '```' 35 | }); 36 | } 37 | } else if (command.text.startsWith('schema')) { 38 | const db = command.text.split(' ')[1]; 39 | const table = command.text.split(' ')[2]; 40 | logger.info(`schema command for ${db}.${table}`); 41 | try { 42 | const schema = await source.getRawSchema(db, table); 43 | if (schema === null) { 44 | await say({ 45 | text: `Table ${db}.${table} not found or there is no schema for it` 46 | }); 47 | return; 48 | } else { 49 | const result = ResultBuilder.buildFromRows(schema); 50 | await say({ 51 | text: `Table ${db}.${table} schema:\n` + '```' + result.slackTableContent + '```' 52 | }); 53 | } 54 | } catch (e: any) { 55 | logger.error(e); 56 | await say({ 57 | text: `Error while getting schema for ${db}.${table}, ${e.message}}` 58 | }); 59 | } 60 | } 61 | await ack(); 62 | } catch (e: any) { 63 | logger.error(e); 64 | await say({ 65 | text: `Error while executing command, ${e.message}}` 66 | }); 67 | } 68 | }); 69 | } 70 | -------------------------------------------------------------------------------- /src/slack/event-handlers/cancel-assumptions-editing.ts: -------------------------------------------------------------------------------- 1 | import { type App, type BlockAction } from '@slack/bolt'; 2 | import { Action } from '../types'; 3 | import { getAssumptionBlocks, getQueryBlocks, getQuestionBlock, getResultBlocks } from '../view/blocks'; 4 | 5 | export default async function handleCancelAssumptionsEditing(app: App): Promise { 6 | app.action(Action.CancelAssumptionsEditing, async ({ ack, client, body }) => { 7 | const actionBody = body as BlockAction; 8 | const isQueryEdited = Boolean(actionBody.message?.metadata.event_payload.edited); 9 | await client.chat.update({ 10 | channel: actionBody.channel?.id!, 11 | ts: actionBody.message?.ts!, 12 | blocks: [ 13 | getQuestionBlock(actionBody.message?.metadata.event_payload.question!), 14 | ...getResultBlocks( 15 | actionBody.message?.metadata.event_payload.previous_result!, 16 | isQueryEdited 17 | ), 18 | ...getAssumptionBlocks(actionBody.message?.metadata.event_payload.previous_assumptions!, isQueryEdited, false), 19 | ...getQueryBlocks( 20 | actionBody.message?.metadata.event_payload.previous_query!, 21 | isQueryEdited, 22 | Boolean(actionBody.message?.metadata.event_payload.is_editing_query) 23 | ) 24 | ], 25 | metadata: { 26 | event_type: 'original_response', 27 | event_payload: { 28 | ...actionBody.message?.metadata.event_payload, 29 | is_editing_assumptions: false 30 | } 31 | } 32 | }); 33 | 34 | await ack(); 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /src/slack/event-handlers/cancel-query-editing.ts: -------------------------------------------------------------------------------- 1 | import { type App, type BlockAction } from '@slack/bolt'; 2 | import { Action } from '../types'; 3 | import { getAssumptionBlocks, getQueryBlocks, getQuestionBlock, getResultBlocks } from '../view/blocks'; 4 | 5 | export default async function handleCancelQueryEditing(app: App): Promise { 6 | app.action(Action.CancelQueryEditing, async ({ ack, client, body }) => { 7 | const actionBody = body as BlockAction; 8 | const isQueryEdited = Boolean(actionBody.message?.metadata.event_payload.edited); 9 | await client.chat.update({ 10 | channel: actionBody.channel?.id!, 11 | ts: actionBody.message?.ts!, 12 | blocks: [ 13 | getQuestionBlock(actionBody.message?.metadata.event_payload.question!), 14 | ...getResultBlocks( 15 | actionBody.message?.metadata.event_payload.previous_result!, 16 | isQueryEdited 17 | ), 18 | ...getAssumptionBlocks( 19 | actionBody.message?.metadata.event_payload.previous_assumptions!, 20 | isQueryEdited, 21 | Boolean(actionBody.message?.metadata.event_payload.is_editing_assumptions) 22 | ), 23 | ...getQueryBlocks( 24 | actionBody.message?.metadata.event_payload.previous_query!, 25 | isQueryEdited, 26 | false 27 | ) 28 | ], 29 | metadata: { 30 | event_type: 'original_response', 31 | event_payload: { 32 | ...actionBody.message?.metadata.event_payload, 33 | is_editing_query: false 34 | } 35 | } 36 | }); 37 | 38 | await ack(); 39 | }); 40 | } 41 | -------------------------------------------------------------------------------- /src/slack/event-handlers/edit-assumptions.ts: -------------------------------------------------------------------------------- 1 | import { type App, type BlockAction } from '@slack/bolt'; 2 | import { Action } from '../types'; 3 | import { getAssumptionBlocks, getQueryBlocks, getQuestionBlock, getResultBlocks } from '../view/blocks'; 4 | 5 | export default async function handleEditAssumptions(app: App): Promise { 6 | app.action(Action.EditAssumptions, async ({ ack, client, body }) => { 7 | const actionBody = body as BlockAction; 8 | 9 | await client.chat.update({ 10 | channel: actionBody.channel?.id!, 11 | ts: actionBody.message?.ts!, 12 | blocks: [ 13 | getQuestionBlock(actionBody.message?.metadata.event_payload.question!), 14 | ...getResultBlocks( 15 | actionBody.message?.metadata.event_payload.previous_result!, 16 | Boolean(actionBody.message?.metadata.event_payload.edited) 17 | ), 18 | ...getAssumptionBlocks(actionBody.message?.metadata.event_payload.previous_assumptions, false, true), 19 | ...getQueryBlocks( 20 | actionBody.message?.metadata.event_payload.previous_query!, 21 | Boolean(actionBody.message?.metadata.event_payload.edited), 22 | Boolean(actionBody.message?.metadata.event_payload.is_editing_query!) 23 | ) 24 | ], 25 | metadata: { 26 | event_type: 'original_response', 27 | event_payload: { 28 | ...actionBody.message?.metadata.event_payload, 29 | is_editing_assumptions: true 30 | } 31 | } 32 | }); 33 | 34 | await ack(); 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /src/slack/event-handlers/edit-query.ts: -------------------------------------------------------------------------------- 1 | import { type App, type BlockAction } from '@slack/bolt'; 2 | import { Action } from '../types'; 3 | import { getAssumptionBlocks, getQueryBlocks, getQuestionBlock, getResultBlocks } from '../view/blocks'; 4 | 5 | export default async function handleEditQuery(app: App): Promise { 6 | app.action(Action.EditQuery, async ({ ack, client, body }) => { 7 | const actionBody = body as BlockAction; 8 | const isQueryEdited = Boolean(actionBody.message?.metadata.event_payload.edited); 9 | 10 | await client.chat.update({ 11 | channel: actionBody.channel?.id!, 12 | ts: actionBody.message?.ts!, 13 | blocks: [ 14 | getQuestionBlock(actionBody.message?.metadata.event_payload.question!), 15 | ...getResultBlocks( 16 | actionBody.message?.metadata.event_payload.previous_result!, 17 | Boolean(actionBody.message?.metadata.event_payload.edited) 18 | ), 19 | ...getAssumptionBlocks( 20 | actionBody.message?.metadata.event_payload.previous_assumptions!, 21 | isQueryEdited, 22 | Boolean(actionBody.message?.metadata.event_payload.is_editing_assumptions) 23 | ), 24 | ...getQueryBlocks(actionBody.message?.metadata.event_payload.previous_query, false, true) 25 | ], 26 | metadata: { 27 | event_type: 'original_response', 28 | event_payload: { 29 | ...actionBody.message?.metadata.event_payload, 30 | is_editing_query: true 31 | } 32 | } 33 | }) 34 | await ack(); 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /src/slack/types.ts: -------------------------------------------------------------------------------- 1 | export enum Action { 2 | EditQuery = 'edit_query', 3 | CancelQueryEditing = 'cancel_query_editing', 4 | RunEditedQuery = 'run_edited_query', 5 | UpdateAssumptions = 'update_assumptions', 6 | EditAssumptions = 'edit_assumptions', 7 | CancelAssumptionsEditing = 'cancel_assumptions_editing', 8 | } 9 | 10 | export enum Event { 11 | OriginalResponse = 'original_response' 12 | } 13 | -------------------------------------------------------------------------------- /src/utils/logger.ts: -------------------------------------------------------------------------------- 1 | import winston, { type Logger } from 'winston'; 2 | 3 | const logFormat = winston.format.printf( 4 | ({ level, message, label, timestamp }) => { 5 | return `${timestamp} [${label}] ${level}: ${message}`; 6 | } 7 | ); 8 | 9 | const enableDebugLogging: boolean = Boolean(process.env.ENABLE_DEBUG_LOGGING); 10 | const transports = [ 11 | new winston.transports.Console({ 12 | level: enableDebugLogging ? 'debug' : 'info' 13 | }) 14 | ]; 15 | 16 | const rootLogger = winston.createLogger({ 17 | transports, 18 | format: winston.format.combine( 19 | winston.format.timestamp(), 20 | winston.format.prettyPrint(), 21 | winston.format.colorize(), 22 | logFormat 23 | ) 24 | }); 25 | 26 | export default function getLogger(label: string): Logger { 27 | return rootLogger.child({ label }); 28 | }; 29 | -------------------------------------------------------------------------------- /src/utils/ssh-tunnel.ts: -------------------------------------------------------------------------------- 1 | import { createTunnel } from 'tunnel-ssh'; 2 | import type * as ssh2 from 'ssh2'; 3 | import { userInfo } from 'os'; 4 | import getLogger from './logger'; 5 | 6 | const logger = getLogger('SSHTUnnel'); 7 | 8 | export async function createSSHTunnelIfNecessary(): Promise { 9 | if (!process.env.SSH_TUNNEL_ENABLE) { 10 | return; 11 | } 12 | 13 | const remoteHostAddress = process.env.SSH_TUNNEL_REMOTE_HOST_ADDRESS; 14 | const remoteHostPort = process.env.SSH_TUNNEL_REMOTE_HOST_PORT; 15 | const username = process.env.SSH_TUNNEL_USERNAME; 16 | const password = process.env.SSH_TUNNEL_PASSWORD; 17 | const privateKey = process.env.SSH_TUNNEL_PRIVATE_KEY; 18 | const destinationIP = process.env.SSH_TUNNEL_DESTINATION_IP; 19 | const destinationPort = (Number(process.env.SSH_TUNNEL_DESTINATION_PORT) || null); 20 | const sourcePort = Number(process.env.SSH_TUNNEL_SOURCE_PORT ?? process.env.SSH_TUNNEL_DESTINATION_PORT); 21 | 22 | if (remoteHostAddress == null || destinationIP == null || destinationPort == null) { 23 | throw new Error('Missing necessary configs to start the ssh tunnel, make sure you provide SSH_TUNNEL_REMOTE_HOST, SSH_TUNNEL_DESTINATION_IP and SSH_TUNNEL_DESTINATION_PORT.'); 24 | } 25 | if (password == null && privateKey == null) { 26 | throw new Error('Missing authentication mechanism, make sure you provide either SSH_TUNNEL_PASSWORD or SSH_TUNNEL_PRIVATE_KEY.'); 27 | } 28 | 29 | const sshOptions: ssh2.ConnectConfig = { 30 | host: remoteHostAddress, 31 | port: (Number(remoteHostPort) || 22), 32 | username: username || userInfo().username 33 | }; 34 | if (password) { 35 | sshOptions.password = password; 36 | } 37 | if (privateKey) { 38 | sshOptions.privateKey = privateKey; 39 | } 40 | 41 | const forwardOptions = { 42 | srcAddr: 'localhost', 43 | srcPort: sourcePort, 44 | dstAddr: destinationIP, 45 | dstPort: destinationPort 46 | } 47 | 48 | const serverOptions = { 49 | port: sourcePort 50 | } 51 | 52 | await createTunnel({}, serverOptions, sshOptions, forwardOptions); 53 | logger.info('Successfully established the ssh tunnel'); 54 | } 55 | -------------------------------------------------------------------------------- /src/web/components/Buttons/SidebarActionButton/SidebarActionButton.tsx: -------------------------------------------------------------------------------- 1 | import { type MouseEventHandler, type ReactElement } from 'react'; 2 | 3 | interface Props { 4 | handleClick: MouseEventHandler 5 | children: ReactElement 6 | } 7 | 8 | const SidebarActionButton = ({ handleClick, children }: Props) => ( 9 | 15 | ); 16 | 17 | export default SidebarActionButton; 18 | -------------------------------------------------------------------------------- /src/web/components/Buttons/SidebarActionButton/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './SidebarActionButton'; 2 | -------------------------------------------------------------------------------- /src/web/components/Chat/Assumption.tsx: -------------------------------------------------------------------------------- 1 | import { vscodeDark } from '@uiw/codemirror-theme-vscode'; 2 | import CodeMirror from '@uiw/react-codemirror'; 3 | import React, { useState, type FC } from 'react'; 4 | import ReactMarkdown from 'react-markdown'; 5 | import { markdown } from '@codemirror/lang-markdown'; 6 | import { EditorView } from '@codemirror/view'; 7 | 8 | interface Props { 9 | assumptions: string 10 | onUpdate: (assumptions: string) => Promise 11 | } 12 | 13 | export const Assumption: FC = ({ assumptions, onUpdate }) => { 14 | if (!assumptions) { 15 | return <>; 16 | } 17 | 18 | const [isEditing, setIsEditing] = useState(false); 19 | const [isRunning, setIsRunning] = useState(false); 20 | const [editedAssumptions, setEditedAssumptions] = useState(assumptions); 21 | 22 | return ( 23 | <> 24 | {(!isEditing) 25 | ? <> 26 | 27 | {assumptions} 28 | 29 | Notice any problems with the assumptions? Click to update. 33 | 34 | : <> 35 | { setEditedAssumptions(a); }} 39 | basicSetup={{ 40 | lineNumbers: isEditing, 41 | foldGutter: false 42 | }} 43 | readOnly={isRunning} 44 | editable={!isRunning} 45 | theme={vscodeDark} 46 | extensions={[ 47 | markdown(), 48 | EditorView.lineWrapping 49 | ]} 50 | /> 51 | {(!isRunning) 52 | ?
53 | 63 | | 64 | 72 |
73 | : Updating... 74 | } 75 | 76 | } 77 | 78 | ) 79 | }; 80 | -------------------------------------------------------------------------------- /src/web/components/Chat/ChatLoader.tsx: -------------------------------------------------------------------------------- 1 | import { IconDots, IconRobot } from '@tabler/icons-react'; 2 | import { type FC } from 'react'; 3 | 4 | interface Props { } 5 | 6 | export const ChatLoader: FC = () => { 7 | return ( 8 |
12 |
13 |
14 | 15 |
16 | 17 |
18 |
19 | ); 20 | }; 21 | -------------------------------------------------------------------------------- /src/web/components/Chat/ErrorMessageDiv.tsx: -------------------------------------------------------------------------------- 1 | import { IconCircleX } from '@tabler/icons-react'; 2 | import { type FC } from 'react'; 3 | 4 | import { type ErrorMessage } from '@/types/error'; 5 | 6 | interface Props { 7 | error: ErrorMessage 8 | } 9 | 10 | export const ErrorMessageDiv: FC = ({ error }) => { 11 | return ( 12 |
13 |
14 | 15 |
16 |
{error.title}
17 | {error.messageLines.map((line, index) => ( 18 |
19 | {' '} 20 | {line}{' '} 21 |
22 | ))} 23 |
24 | {error.code ? Code: {error.code} : ''} 25 |
26 |
27 | ); 28 | }; 29 | -------------------------------------------------------------------------------- /src/web/components/Chat/Instruction.tsx: -------------------------------------------------------------------------------- 1 | import { List, ListItem, ListItemButton, ListItemText } from '@mui/material'; 2 | import Card from '@mui/material/Card'; 3 | import CardContent from '@mui/material/CardContent'; 4 | import Typography from '@mui/material/Typography'; 5 | 6 | interface Props { 7 | askQuestion: (question: string) => Promise 8 | } 9 | 10 | const questions = [ 11 | 'What are the top 10 products by revenue?', 12 | 'What are the top 10 products by revenue in the last 30 days?', 13 | 'How many orders were placed in the last 30 days?', 14 | 'How many users placed orders in the last 30 days?' 15 | ] 16 | 17 | export const Instruction = (props: Props) => { 18 | const { askQuestion } = props; 19 | 20 | return ( 21 | 22 | 23 | { /** ---- Instruction ---- */} 24 | 25 | Instruction 26 | 27 | 28 | 29 |

30 | This demo shows how you can use DSensei to ask questions about a dataset. A few example questions are listed below, but you can ask any data question you want. 31 |

32 |
33 | 34 | { /* ---- Dataset Info ---- */} 35 | 36 | Dataset Info 37 | 38 | 39 | 40 |

41 | This demo uses the theLook eCommerce dataset, which contains 1.5 million rows of data from an online retailer. 42 |

43 |

44 | To inspect the schema of the dataset, you can click the "Show Schemas" button at the bottom left of the screen. 45 |

46 |
47 | 48 | { /* ---- Example Questions ---- */} 49 | 50 | Example Questions: 51 | 52 | 53 | 54 |

55 | You can click on any of the questions below to ask it to the model. 56 |

57 |
58 | 59 | 60 | { 61 | questions.map((question, index) => { 62 | return ( 63 | 64 | { await askQuestion(question); }}> 65 | 66 | 67 | 68 | ); 69 | })} 70 | 71 | 72 |
73 |
74 | ) 75 | } 76 | -------------------------------------------------------------------------------- /src/web/components/Chat/MemoizedChatMessage.tsx: -------------------------------------------------------------------------------- 1 | import { type FC, memo } from 'react'; 2 | import { ChatMessage, type Props } from './ChatMessage'; 3 | 4 | export const MemoizedChatMessage: FC = memo( 5 | ChatMessage, 6 | (prevProps, nextProps) => ( 7 | prevProps.message.content === nextProps.message.content 8 | ) 9 | ); 10 | -------------------------------------------------------------------------------- /src/web/components/Chat/ModelSelect.tsx: -------------------------------------------------------------------------------- 1 | import { IconExternalLink } from '@tabler/icons-react'; 2 | import { useContext } from 'react'; 3 | 4 | import { type OpenAIModel } from '@/types/openai'; 5 | 6 | import HomeContext from '@/pages/api/home/home.context'; 7 | 8 | export const ModelSelect = () => { 9 | const { state: { selectedConversation, models, defaultModelId }, handleUpdateConversation } = useContext(HomeContext); 10 | 11 | const handleChange = (e: React.ChangeEvent) => { 12 | selectedConversation && 13 | handleUpdateConversation(selectedConversation, { 14 | key: 'model', 15 | value: models.find( 16 | (model) => model.id === e.target.value 17 | ) as OpenAIModel 18 | }); 19 | }; 20 | 21 | return ( 22 |
23 | 26 |
27 | 45 |
46 |
47 | 52 | 53 | 54 |
55 |
56 | ); 57 | }; 58 | -------------------------------------------------------------------------------- /src/web/components/Chat/PluginSelect.tsx: -------------------------------------------------------------------------------- 1 | import { type FC, useEffect, useRef } from 'react'; 2 | 3 | import { type Plugin, PluginList } from '@/types/plugin'; 4 | 5 | interface Props { 6 | plugin: Plugin | null 7 | onPluginChange: (plugin: Plugin) => void 8 | onKeyDown: (e: React.KeyboardEvent) => void 9 | } 10 | 11 | export const PluginSelect: FC = ({ 12 | plugin, 13 | onPluginChange, 14 | onKeyDown 15 | }) => { 16 | const selectRef = useRef(null); 17 | 18 | const handleKeyDown = (e: React.KeyboardEvent) => { 19 | const selectElement = selectRef.current; 20 | const optionCount = selectElement?.options.length || 0; 21 | 22 | if (e.key === '/' && e.metaKey) { 23 | e.preventDefault(); 24 | if (selectElement) { 25 | selectElement.selectedIndex = 26 | (selectElement.selectedIndex + 1) % optionCount; 27 | selectElement.dispatchEvent(new Event('change')); 28 | } 29 | } else if (e.key === '/' && e.shiftKey && e.metaKey) { 30 | e.preventDefault(); 31 | if (selectElement) { 32 | selectElement.selectedIndex = 33 | (selectElement.selectedIndex - 1 + optionCount) % optionCount; 34 | selectElement.dispatchEvent(new Event('change')); 35 | } 36 | } else if (e.key === 'Enter') { 37 | e.preventDefault(); 38 | if (selectElement) { 39 | selectElement.dispatchEvent(new Event('change')); 40 | } 41 | 42 | onPluginChange( 43 | PluginList.find( 44 | (plugin) => 45 | plugin.name === selectElement?.selectedOptions[0].innerText 46 | ) as Plugin 47 | ); 48 | } else { 49 | onKeyDown(e); 50 | } 51 | }; 52 | 53 | useEffect(() => { 54 | if (selectRef.current) { 55 | selectRef.current.focus(); 56 | } 57 | }, []); 58 | 59 | return ( 60 |
61 |
62 | 96 |
97 |
98 | ); 99 | }; 100 | -------------------------------------------------------------------------------- /src/web/components/Chat/PromptList.tsx: -------------------------------------------------------------------------------- 1 | import { type FC, type MutableRefObject } from 'react'; 2 | 3 | import { type Prompt } from '@/types/prompt'; 4 | 5 | interface Props { 6 | prompts: Prompt[] 7 | activePromptIndex: number 8 | onSelect: () => void 9 | onMouseOver: (index: number) => void 10 | promptListRef: MutableRefObject 11 | } 12 | 13 | export const PromptList: FC = ({ 14 | prompts, 15 | activePromptIndex, 16 | onSelect, 17 | onMouseOver, 18 | promptListRef 19 | }) => { 20 | return ( 21 |
    25 | {prompts.map((prompt, index) => ( 26 |
  • { 34 | e.preventDefault(); 35 | e.stopPropagation(); 36 | onSelect(); 37 | }} 38 | onMouseEnter={() => { onMouseOver(index); }} 39 | > 40 | {prompt.name} 41 |
  • 42 | ))} 43 |
44 | ); 45 | }; 46 | -------------------------------------------------------------------------------- /src/web/components/Chat/Regenerate.tsx: -------------------------------------------------------------------------------- 1 | import { IconRefresh } from '@tabler/icons-react'; 2 | import { type FC } from 'react'; 3 | 4 | interface Props { 5 | onRegenerate: () => void 6 | } 7 | 8 | export const Regenerate: FC = ({ onRegenerate }) => { 9 | return ( 10 |
11 |
12 | {'Sorry, there was an error.'} 13 |
14 | 21 |
22 | ); 23 | }; 24 | -------------------------------------------------------------------------------- /src/web/components/Chat/Temperature.tsx: -------------------------------------------------------------------------------- 1 | import { type FC, useContext, useState } from 'react'; 2 | 3 | import { DEFAULT_TEMPERATURE } from '@/utils/app/const'; 4 | 5 | import HomeContext from '@/pages/api/home/home.context'; 6 | 7 | interface Props { 8 | label: string 9 | onChangeTemperature: (temperature: number) => void 10 | } 11 | 12 | export const TemperatureSlider: FC = ({ 13 | label, 14 | onChangeTemperature 15 | }) => { 16 | const { 17 | state: { conversations } 18 | } = useContext(HomeContext); 19 | const lastConversation = conversations[conversations.length - 1]; 20 | const [temperature, setTemperature] = useState( 21 | lastConversation?.temperature ?? DEFAULT_TEMPERATURE 22 | ); 23 | const handleChange = (event: React.ChangeEvent) => { 24 | const newValue = parseFloat(event.target.value); 25 | setTemperature(newValue); 26 | onChangeTemperature(newValue); 27 | }; 28 | 29 | return ( 30 |
31 | 34 | 35 | Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. 36 | 37 | 38 | {temperature.toFixed(1)} 39 | 40 | 49 |
    50 |
  • 51 | {'Precise'} 52 |
  • 53 |
  • 54 | {'Neutral'} 55 |
  • 56 |
  • 57 | {'Creative'} 58 |
  • 59 |
60 |
61 | ); 62 | }; 63 | -------------------------------------------------------------------------------- /src/web/components/Chatbar/Chatbar.context.tsx: -------------------------------------------------------------------------------- 1 | import { type Dispatch, createContext } from 'react'; 2 | 3 | import { type ActionType } from '@/hooks/useCreateReducer'; 4 | 5 | import { type Conversation } from '@/types/chat'; 6 | import { type SupportedExportFormats } from '@/types/export'; 7 | import { type PluginKey } from '@/types/plugin'; 8 | 9 | import { type ChatbarInitialState } from './Chatbar.state'; 10 | 11 | export interface ChatbarContextProps { 12 | state: ChatbarInitialState 13 | dispatch: Dispatch> 14 | handleDeleteConversation: (conversation: Conversation) => void 15 | handleClearConversations: () => void 16 | handleExportData: () => void 17 | handleImportConversations: (data: SupportedExportFormats) => void 18 | handlePluginKeyChange: (pluginKey: PluginKey) => void 19 | handleClearPluginKey: (pluginKey: PluginKey) => void 20 | handleApiKeyChange: (apiKey: string) => void 21 | } 22 | 23 | const ChatbarContext = createContext(undefined!); 24 | 25 | export default ChatbarContext; 26 | -------------------------------------------------------------------------------- /src/web/components/Chatbar/Chatbar.state.tsx: -------------------------------------------------------------------------------- 1 | import { type Conversation } from '@/types/chat'; 2 | 3 | export interface ChatbarInitialState { 4 | searchTerm: string 5 | filteredConversations: Conversation[] 6 | } 7 | 8 | export const initialState: ChatbarInitialState = { 9 | searchTerm: '', 10 | filteredConversations: [] 11 | }; 12 | -------------------------------------------------------------------------------- /src/web/components/Chatbar/components/ChatFolders.tsx: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react'; 2 | 3 | import { type FolderInterface } from '@/types/folder'; 4 | 5 | import HomeContext from '@/pages/api/home/home.context'; 6 | 7 | import Folder from '@/components/Folder'; 8 | 9 | import { ConversationComponent } from './Conversation'; 10 | 11 | interface Props { 12 | searchTerm: string 13 | } 14 | 15 | export const ChatFolders = ({ searchTerm }: Props) => { 16 | const { 17 | state: { folders, conversations }, 18 | handleUpdateConversation 19 | } = useContext(HomeContext); 20 | 21 | const handleDrop = (e: any, folder: FolderInterface) => { 22 | if (e.dataTransfer) { 23 | const conversation = JSON.parse(e.dataTransfer.getData('conversation')); 24 | handleUpdateConversation(conversation, { 25 | key: 'folderId', 26 | value: folder.id 27 | }); 28 | } 29 | }; 30 | 31 | const ChatFolders = (currentFolder: FolderInterface) => { 32 | return ( 33 | conversations?.filter((conversation) => conversation.folderId).map((conversation, index) => { 34 | if (conversation.folderId === currentFolder.id) { 35 | return ( 36 |
37 | 38 |
39 | ); 40 | } 41 | return <>; 42 | }) 43 | ); 44 | }; 45 | 46 | return ( 47 |
48 | {folders 49 | .filter((folder) => folder.type === 'chat') 50 | .sort((a, b) => a.name.localeCompare(b.name)) 51 | .map((folder, index) => ( 52 | 59 | ))} 60 |
61 | ); 62 | }; 63 | -------------------------------------------------------------------------------- /src/web/components/Chatbar/components/ChatbarSettings.tsx: -------------------------------------------------------------------------------- 1 | import { IconFileExport, IconMail, IconSchema, IconSettings } from '@tabler/icons-react'; 2 | import { useContext, useState } from 'react'; 3 | 4 | import HomeContext from '@/pages/api/home/home.context'; 5 | 6 | import { SettingDialog } from '@/components/Settings/SettingDialog'; 7 | 8 | import { Import } from '../../Settings/Import'; 9 | import { Key } from '../../Settings/Key'; 10 | import { SidebarButton } from '../../Sidebar/SidebarButton'; 11 | import ChatbarContext from '../Chatbar.context'; 12 | import { ClearConversations } from './ClearConversations'; 13 | import { SchemasDialog } from '@/components/Schemas/SchemasDialog'; 14 | 15 | export const ChatbarSettings = () => { 16 | const [showSettingDialog, setShowSettingDialog] = useState(false); 17 | 18 | const { 19 | state: { 20 | apiKey, 21 | serverSideApiKeyIsSet, 22 | conversations, 23 | showSchemasDialog 24 | }, 25 | dispatch 26 | } = useContext(HomeContext); 27 | 28 | const { 29 | handleClearConversations, 30 | handleImportConversations, 31 | handleExportData, 32 | handleApiKeyChange 33 | } = useContext(ChatbarContext); 34 | 35 | return ( 36 |
37 | {conversations.length > 0 38 | ? ( 39 | 40 | ) 41 | : null} 42 | 43 | 44 | 45 | } 48 | onClick={() => { handleExportData(); }} 49 | /> 50 | 51 | } 54 | onClick={() => { 55 | dispatch({ 56 | field: 'showSchemasDialog', 57 | value: true 58 | }) 59 | }} 60 | /> 61 | 62 | } 65 | onClick={() => { setShowSettingDialog(true); }} 66 | /> 67 | 68 | {!serverSideApiKeyIsSet 69 | ? ( 70 | 71 | ) 72 | : null} 73 | 74 | {/* {!serverSidePluginKeysSet ? : null} */} 75 | 76 | { 79 | setShowSettingDialog(false); 80 | }} 81 | /> 82 | 83 | { 86 | dispatch({ 87 | field: 'showSchemasDialog', 88 | value: false 89 | }); 90 | }} 91 | /> 92 | 93 | } 96 | onClick={() => { 97 | window.location.href = 'mailto:yulong@dsensei.dev' 98 | }} 99 | /> 100 |
101 | ); 102 | }; 103 | -------------------------------------------------------------------------------- /src/web/components/Chatbar/components/ClearConversations.tsx: -------------------------------------------------------------------------------- 1 | import { IconCheck, IconTrash, IconX } from '@tabler/icons-react'; 2 | import { type FC, useState } from 'react'; 3 | 4 | import { SidebarButton } from '@/components/Sidebar/SidebarButton'; 5 | 6 | interface Props { 7 | onClearConversations: () => void 8 | } 9 | 10 | export const ClearConversations: FC = ({ onClearConversations }) => { 11 | const [isConfirming, setIsConfirming] = useState(false); 12 | 13 | const handleClearConversations = () => { 14 | onClearConversations(); 15 | setIsConfirming(false); 16 | }; 17 | 18 | return isConfirming 19 | ? ( 20 |
21 | 22 | 23 |
24 | {'Are you sure?'} 25 |
26 | 27 |
28 | { 32 | e.stopPropagation(); 33 | handleClearConversations(); 34 | }} 35 | /> 36 | 37 | { 41 | e.stopPropagation(); 42 | setIsConfirming(false); 43 | }} 44 | /> 45 |
46 |
47 | ) 48 | : ( 49 | } 52 | onClick={() => { setIsConfirming(true); }} 53 | /> 54 | ); 55 | }; 56 | -------------------------------------------------------------------------------- /src/web/components/Chatbar/components/Conversations.tsx: -------------------------------------------------------------------------------- 1 | import { type Conversation } from '@/types/chat'; 2 | 3 | import { ConversationComponent } from './Conversation'; 4 | 5 | interface Props { 6 | conversations: Conversation[] 7 | } 8 | 9 | export const Conversations = ({ conversations }: Props) => { 10 | return ( 11 |
12 | {conversations 13 | .filter((conversation) => !conversation.folderId) 14 | .slice() 15 | .reverse() 16 | .map((conversation, index) => ( 17 | 18 | ))} 19 |
20 | ); 21 | }; 22 | -------------------------------------------------------------------------------- /src/web/components/Folder/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Folder'; 2 | -------------------------------------------------------------------------------- /src/web/components/Markdown/CodeBlock.tsx: -------------------------------------------------------------------------------- 1 | import { IconCheck, IconClipboard, IconDownload } from '@tabler/icons-react'; 2 | import { type FC, memo, useState } from 'react'; 3 | import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; 4 | import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism'; 5 | 6 | import { 7 | generateRandomString, 8 | programmingLanguages 9 | } from '@/utils/app/codeblock'; 10 | 11 | interface Props { 12 | language: string 13 | value: string 14 | } 15 | 16 | export const CodeBlock: FC = memo(({ language, value }) => { 17 | const [isCopied, setIsCopied] = useState(false); 18 | 19 | const copyToClipboard = () => { 20 | if (!navigator.clipboard?.writeText) { 21 | return; 22 | } 23 | 24 | void navigator.clipboard.writeText(value).then(() => { 25 | setIsCopied(true); 26 | 27 | setTimeout(() => { 28 | setIsCopied(false); 29 | }, 2000); 30 | }); 31 | }; 32 | const downloadAsFile = () => { 33 | const fileExtension = programmingLanguages[language] || '.file'; 34 | const suggestedFileName = `file-${generateRandomString( 35 | 3, 36 | true 37 | )}${fileExtension}`; 38 | const fileName = window.prompt( 39 | 'Enter file name', 40 | suggestedFileName 41 | ); 42 | 43 | if (!fileName) { 44 | // user pressed cancel on prompt 45 | return; 46 | } 47 | 48 | const blob = new Blob([value], { type: 'text/plain' }); 49 | const url = URL.createObjectURL(blob); 50 | const link = document.createElement('a'); 51 | link.download = fileName; 52 | link.href = url; 53 | link.style.display = 'none'; 54 | document.body.appendChild(link); 55 | link.click(); 56 | document.body.removeChild(link); 57 | URL.revokeObjectURL(url); 58 | }; 59 | return ( 60 |
61 |
62 | {language} 63 | 64 |
65 | 72 | 78 |
79 |
80 | 81 | 86 | {value} 87 | 88 |
89 | ); 90 | }); 91 | CodeBlock.displayName = 'CodeBlock'; 92 | -------------------------------------------------------------------------------- /src/web/components/Mobile/Navbar.tsx: -------------------------------------------------------------------------------- 1 | import { IconPlus } from '@tabler/icons-react'; 2 | import { type FC } from 'react'; 3 | 4 | import { type Conversation } from '@/types/chat'; 5 | 6 | interface Props { 7 | selectedConversation: Conversation 8 | onNewConversation: () => void 9 | } 10 | 11 | export const Navbar: FC = ({ 12 | selectedConversation, 13 | onNewConversation 14 | }) => { 15 | return ( 16 | 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /src/web/components/Promptbar/PromptBar.context.tsx: -------------------------------------------------------------------------------- 1 | import { type Dispatch, createContext } from 'react'; 2 | 3 | import { type ActionType } from '@/hooks/useCreateReducer'; 4 | 5 | import { type Prompt } from '@/types/prompt'; 6 | 7 | import { type PromptbarInitialState } from './Promptbar.state'; 8 | 9 | export interface PromptbarContextProps { 10 | state: PromptbarInitialState 11 | dispatch: Dispatch> 12 | handleCreatePrompt: () => void 13 | handleDeletePrompt: (prompt: Prompt) => void 14 | handleUpdatePrompt: (prompt: Prompt) => void 15 | } 16 | 17 | const PromptbarContext = createContext(undefined!); 18 | 19 | export default PromptbarContext; 20 | -------------------------------------------------------------------------------- /src/web/components/Promptbar/Promptbar.state.tsx: -------------------------------------------------------------------------------- 1 | import { type Prompt } from '@/types/prompt'; 2 | 3 | export interface PromptbarInitialState { 4 | searchTerm: string 5 | filteredPrompts: Prompt[] 6 | } 7 | 8 | export const initialState: PromptbarInitialState = { 9 | searchTerm: '', 10 | filteredPrompts: [] 11 | }; 12 | -------------------------------------------------------------------------------- /src/web/components/Promptbar/components/PromptFolders.tsx: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react'; 2 | 3 | import { type FolderInterface } from '@/types/folder'; 4 | 5 | import HomeContext from '@/pages/api/home/home.context'; 6 | 7 | import Folder from '@/components/Folder'; 8 | import { PromptComponent } from '@/components/Promptbar/components/Prompt'; 9 | 10 | import PromptbarContext from '../PromptBar.context'; 11 | 12 | export const PromptFolders = () => { 13 | const { 14 | state: { folders } 15 | } = useContext(HomeContext); 16 | 17 | const { 18 | state: { searchTerm, filteredPrompts }, 19 | handleUpdatePrompt 20 | } = useContext(PromptbarContext); 21 | 22 | const handleDrop = (e: any, folder: FolderInterface) => { 23 | if (e.dataTransfer) { 24 | const prompt = JSON.parse(e.dataTransfer.getData('prompt')); 25 | 26 | const updatedPrompt = { 27 | ...prompt, 28 | folderId: folder.id 29 | }; 30 | 31 | handleUpdatePrompt(updatedPrompt); 32 | } 33 | }; 34 | 35 | const PromptFolders = (currentFolder: FolderInterface) => 36 | filteredPrompts 37 | .filter((p) => p.folderId) 38 | .map((prompt, index) => { 39 | if (prompt.folderId === currentFolder.id) { 40 | return ( 41 |
42 | 43 |
44 | ); 45 | } 46 | return <>; 47 | }); 48 | 49 | return ( 50 |
51 | {folders 52 | .filter((folder) => folder.type === 'prompt') 53 | .sort((a, b) => a.name.localeCompare(b.name)) 54 | .map((folder, index) => ( 55 | 62 | ))} 63 |
64 | ); 65 | }; 66 | -------------------------------------------------------------------------------- /src/web/components/Promptbar/components/PromptbarSettings.tsx: -------------------------------------------------------------------------------- 1 | import { type FC } from 'react'; 2 | 3 | interface Props {} 4 | 5 | export const PromptbarSettings: FC = () => { 6 | return
; 7 | }; 8 | -------------------------------------------------------------------------------- /src/web/components/Promptbar/components/Prompts.tsx: -------------------------------------------------------------------------------- 1 | import { type FC } from 'react'; 2 | 3 | import { type Prompt } from '@/types/prompt'; 4 | 5 | import { PromptComponent } from './Prompt'; 6 | 7 | interface Props { 8 | prompts: Prompt[] 9 | } 10 | 11 | export const Prompts: FC = ({ prompts }) => { 12 | return ( 13 |
14 | {prompts 15 | .slice() 16 | .reverse() 17 | .map((prompt, index) => ( 18 | 19 | ))} 20 |
21 | ); 22 | }; 23 | -------------------------------------------------------------------------------- /src/web/components/Promptbar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Promptbar'; 2 | -------------------------------------------------------------------------------- /src/web/components/Search/Search.tsx: -------------------------------------------------------------------------------- 1 | import { IconX } from '@tabler/icons-react'; 2 | import { type FC } from 'react'; 3 | 4 | interface Props { 5 | placeholder: string 6 | searchTerm: string 7 | onSearch: (searchTerm: string) => void 8 | } 9 | const Search: FC = ({ placeholder, searchTerm, onSearch }) => { 10 | const handleSearchChange = (e: React.ChangeEvent) => { 11 | onSearch(e.target.value); 12 | }; 13 | 14 | const clearSearch = () => { 15 | onSearch(''); 16 | }; 17 | 18 | return ( 19 |
20 | 27 | 28 | {searchTerm && ( 29 | 34 | )} 35 |
36 | ); 37 | }; 38 | 39 | export default Search; 40 | -------------------------------------------------------------------------------- /src/web/components/Search/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Search'; 2 | -------------------------------------------------------------------------------- /src/web/components/Settings/Import.tsx: -------------------------------------------------------------------------------- 1 | import { IconFileImport } from '@tabler/icons-react'; 2 | import { type FC } from 'react'; 3 | 4 | import { type SupportedExportFormats } from '@/types/export'; 5 | 6 | import { SidebarButton } from '../Sidebar/SidebarButton'; 7 | 8 | interface Props { 9 | onImport: (data: SupportedExportFormats) => void 10 | } 11 | 12 | export const Import: FC = ({ onImport }) => { 13 | return ( 14 | <> 15 | { 22 | if (!e.target.files?.length) return; 23 | 24 | const file = e.target.files[0]; 25 | const reader = new FileReader(); 26 | reader.onload = (e) => { 27 | const json = JSON.parse(e.target?.result as string); 28 | onImport(json); 29 | }; 30 | reader.readAsText(file); 31 | }} 32 | /> 33 | 34 | } 37 | onClick={() => { 38 | const importFile = document.querySelector( 39 | '#import-file' 40 | ) as HTMLInputElement; 41 | if (importFile) { 42 | importFile.click(); 43 | } 44 | }} 45 | /> 46 | 47 | ); 48 | }; 49 | -------------------------------------------------------------------------------- /src/web/components/Settings/Key.tsx: -------------------------------------------------------------------------------- 1 | import { IconCheck, IconKey, IconX } from '@tabler/icons-react'; 2 | import { type FC, type KeyboardEvent, useEffect, useRef, useState } from 'react'; 3 | 4 | import { SidebarButton } from '../Sidebar/SidebarButton'; 5 | 6 | interface Props { 7 | apiKey: string 8 | onApiKeyChange: (apiKey: string) => void 9 | } 10 | 11 | export const Key: FC = ({ apiKey, onApiKeyChange }) => { 12 | const [isChanging, setIsChanging] = useState(false); 13 | const [newKey, setNewKey] = useState(apiKey); 14 | const inputRef = useRef(null); 15 | 16 | const handleEnterDown = (e: KeyboardEvent) => { 17 | if (e.key === 'Enter') { 18 | e.preventDefault(); 19 | handleUpdateKey(newKey); 20 | } 21 | }; 22 | 23 | const handleUpdateKey = (newKey: string) => { 24 | onApiKeyChange(newKey.trim()); 25 | setIsChanging(false); 26 | }; 27 | 28 | useEffect(() => { 29 | if (isChanging) { 30 | inputRef.current?.focus(); 31 | } 32 | }, [isChanging]); 33 | 34 | return isChanging 35 | ? ( 36 |
37 | 38 | 39 | { setNewKey(e.target.value); }} 45 | onKeyDown={handleEnterDown} 46 | placeholder='API Key' 47 | /> 48 | 49 |
50 | { 54 | e.stopPropagation(); 55 | handleUpdateKey(newKey); 56 | }} 57 | /> 58 | 59 | { 63 | e.stopPropagation(); 64 | setIsChanging(false); 65 | setNewKey(apiKey); 66 | }} 67 | /> 68 |
69 |
70 | ) 71 | : ( 72 | } 75 | onClick={() => { setIsChanging(true); }} 76 | /> 77 | ); 78 | }; 79 | -------------------------------------------------------------------------------- /src/web/components/Sidebar/SidebarButton.tsx: -------------------------------------------------------------------------------- 1 | import { type FC } from 'react'; 2 | 3 | interface Props { 4 | text: string 5 | icon: JSX.Element 6 | onClick: () => void 7 | } 8 | 9 | export const SidebarButton: FC = ({ text, icon, onClick }) => { 10 | return ( 11 | 18 | ); 19 | }; 20 | -------------------------------------------------------------------------------- /src/web/components/Sidebar/components/OpenCloseButton.tsx: -------------------------------------------------------------------------------- 1 | import { IconArrowBarLeft, IconArrowBarRight } from '@tabler/icons-react'; 2 | 3 | interface Props { 4 | onClick: any 5 | side: 'left' | 'right' 6 | } 7 | 8 | export const CloseSidebarButton = ({ onClick, side }: Props) => { 9 | return ( 10 | <> 11 | 21 |
25 | 26 | ); 27 | }; 28 | 29 | export const OpenSidebarButton = ({ onClick, side }: Props) => { 30 | return ( 31 | 41 | ); 42 | }; 43 | -------------------------------------------------------------------------------- /src/web/components/Sidebar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Sidebar'; 2 | -------------------------------------------------------------------------------- /src/web/components/Spinner/Spinner.tsx: -------------------------------------------------------------------------------- 1 | 2 | interface Props { 3 | size?: string 4 | className?: string 5 | } 6 | 7 | const Spinner = ({ size = '1em', className = '' }: Props) => { 8 | return ( 9 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | ); 31 | }; 32 | 33 | export default Spinner; 34 | -------------------------------------------------------------------------------- /src/web/components/Spinner/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Spinner'; 2 | -------------------------------------------------------------------------------- /src/web/hooks/useCreateReducer.ts: -------------------------------------------------------------------------------- 1 | import { useMemo, useReducer } from 'react'; 2 | 3 | // Extracts property names from initial state of reducer to allow typesafe dispatch objects 4 | export type FieldNames = { 5 | [K in keyof T]: T[K] extends string ? K : K; 6 | }[keyof T]; 7 | 8 | // Returns the Action Type for the dispatch object to be used for typing in things like context 9 | export type ActionType = 10 | | { type: 'reset' } 11 | | { type?: 'change', field: FieldNames, value: any }; 12 | 13 | // Returns a typed dispatch and state 14 | export const useCreateReducer = ({ initialState }: { initialState: T }) => { 15 | type Action = 16 | | { type: 'reset' } 17 | | { type?: 'change', field: FieldNames, value: any }; 18 | 19 | const reducer = (state: T, action: Action) => { 20 | if (!action.type) return { ...state, [action.field]: action.value }; 21 | 22 | if (action.type === 'reset') return initialState; 23 | 24 | throw new Error(); 25 | }; 26 | 27 | const [state, dispatch] = useReducer(reducer, initialState); 28 | 29 | return useMemo(() => ({ state, dispatch }), [state, dispatch]); 30 | }; 31 | -------------------------------------------------------------------------------- /src/web/hooks/useFetch.ts: -------------------------------------------------------------------------------- 1 | export interface RequestModel { 2 | params?: object 3 | headers?: object 4 | signal?: AbortSignal 5 | } 6 | 7 | export type RequestWithBodyModel = RequestModel & { 8 | body?: object | FormData 9 | }; 10 | 11 | export const useFetch = () => { 12 | const handleFetch = async ( 13 | url: string, 14 | request: any, 15 | signal?: AbortSignal 16 | ) => { 17 | const requestUrl = request?.params ? `${url}${request.params}` : url; 18 | 19 | const requestBody = request?.body 20 | ? request.body instanceof FormData 21 | ? { ...request, body: request.body } 22 | : { ...request, body: JSON.stringify(request.body) } 23 | : request; 24 | 25 | const headers = { 26 | ...(request?.headers 27 | ? request.headers 28 | : request?.body && request.body instanceof FormData 29 | ? {} 30 | : { 'Content-type': 'application/json' }) 31 | }; 32 | 33 | return await fetch(requestUrl, { ...requestBody, headers, signal }) 34 | .then(async (response) => { 35 | if (!response.ok) throw new Error(JSON.stringify(response)); 36 | 37 | const contentType = response.headers.get('content-type'); 38 | const contentDisposition = response.headers.get('content-disposition'); 39 | 40 | const result = 41 | contentType && 42 | (contentType?.includes('application/json') || 43 | contentType?.includes('text/plain')) 44 | ? response.json() 45 | : contentDisposition?.includes('attachment') 46 | ? response.blob() 47 | : response; 48 | 49 | return await result; 50 | }) 51 | .catch(async (err) => { 52 | const contentType = err.headers.get('content-type'); 53 | 54 | const errResult = 55 | contentType && contentType?.indexOf('application/problem+json') !== -1 56 | ? await err.json() 57 | : err; 58 | 59 | throw errResult; 60 | }); 61 | }; 62 | 63 | return { 64 | get: async (url: string, request?: RequestModel): Promise => { 65 | return await handleFetch(url, { ...request, method: 'get' }); 66 | }, 67 | post: async ( 68 | url: string, 69 | request?: RequestWithBodyModel 70 | ): Promise => { 71 | return await handleFetch(url, { ...request, method: 'post' }); 72 | }, 73 | put: async (url: string, request?: RequestWithBodyModel): Promise => { 74 | return await handleFetch(url, { ...request, method: 'put' }); 75 | }, 76 | patch: async ( 77 | url: string, 78 | request?: RequestWithBodyModel 79 | ): Promise => { 80 | return await handleFetch(url, { ...request, method: 'patch' }); 81 | }, 82 | delete: async (url: string, request?: RequestModel): Promise => { 83 | return await handleFetch(url, { ...request, method: 'delete' }); 84 | } 85 | }; 86 | }; 87 | -------------------------------------------------------------------------------- /src/web/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /src/web/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | experimental: { 5 | externalDir: true 6 | }, 7 | webpack(config, _) { 8 | config.experiments = { 9 | asyncWebAssembly: true, 10 | layers: true 11 | }; 12 | 13 | return config; 14 | } 15 | }; 16 | 17 | module.exports = nextConfig; 18 | -------------------------------------------------------------------------------- /src/web/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import { Toaster } from 'react-hot-toast'; 2 | import { QueryClient, QueryClientProvider } from 'react-query'; 3 | 4 | import type { AppProps } from 'next/app'; 5 | import { Inter } from 'next/font/google'; 6 | 7 | import '@/styles/globals.css'; 8 | 9 | const inter = Inter({ subsets: ['latin'] }); 10 | 11 | function App({ Component, pageProps }: AppProps) { 12 | const queryClient = new QueryClient(); 13 | 14 | return ( 15 |
16 | 17 | 18 | 19 | 20 |
21 | ); 22 | } 23 | 24 | export default App; 25 | -------------------------------------------------------------------------------- /src/web/pages/_document.tsx: -------------------------------------------------------------------------------- 1 | import { type DocumentProps, Head, Html, Main, NextScript } from 'next/document'; 2 | 3 | type Props = DocumentProps & { 4 | // add custom document props 5 | }; 6 | 7 | export default function Document(_: Props) { 8 | return ( 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /src/web/pages/_error.js: -------------------------------------------------------------------------------- 1 | // Quick workaround for error page 2 | function Error({ statusCode }) { 3 | return ( 4 |

5 | {statusCode 6 | ? `An error ${statusCode} occurred on server` 7 | : 'An error occurred on client'} 8 |

9 | ) 10 | } 11 | 12 | Error.getInitialProps = ({ res, err }) => { 13 | const statusCode = res ? res.statusCode : err ? err.statusCode : 404 14 | return { statusCode } 15 | } 16 | 17 | export default Error; 18 | -------------------------------------------------------------------------------- /src/web/pages/api/chat.ts: -------------------------------------------------------------------------------- 1 | import { DEFAULT_SYSTEM_PROMPT, DEFAULT_TEMPERATURE } from '@/utils/app/const'; 2 | import { OpenAIError, OpenAIStream } from '@/utils/server'; 3 | 4 | import { type ChatBody, type Message } from '@/types/chat'; 5 | 6 | // @ts-expect-error cannot find module 7 | import wasm from '@dqbd/tiktoken/lite/tiktoken_bg.wasm?module'; 8 | import tiktokenModel from '@dqbd/tiktoken/encoders/cl100k_base.json'; 9 | import { Tiktoken, init } from '@dqbd/tiktoken/lite/init'; 10 | 11 | export const config = { 12 | runtime: 'edge' 13 | }; 14 | 15 | const handler = async (req: Request): Promise => { 16 | try { 17 | const { model, messages, key, prompt, temperature } = (await req.json()) as ChatBody; 18 | 19 | await init(async (imports) => await WebAssembly.instantiate(wasm, imports)); 20 | const encoding = new Tiktoken( 21 | tiktokenModel.bpe_ranks, 22 | tiktokenModel.special_tokens, 23 | tiktokenModel.pat_str 24 | ); 25 | 26 | let promptToSend = prompt; 27 | if (!promptToSend) { 28 | promptToSend = DEFAULT_SYSTEM_PROMPT; 29 | } 30 | 31 | let temperatureToUse = temperature; 32 | if (temperatureToUse == null) { 33 | temperatureToUse = DEFAULT_TEMPERATURE; 34 | } 35 | 36 | const promptTokens = encoding.encode(promptToSend); 37 | 38 | let tokenCount = promptTokens.length; 39 | let messagesToSend: Message[] = []; 40 | 41 | for (let i = messages.length - 1; i >= 0; i--) { 42 | const message = messages[i]; 43 | const tokens = encoding.encode(message.content); 44 | 45 | if (tokenCount + tokens.length + 1000 > model.tokenLimit) { 46 | break; 47 | } 48 | tokenCount += tokens.length; 49 | messagesToSend = [message, ...messagesToSend]; 50 | } 51 | 52 | encoding.free(); 53 | 54 | const stream = await OpenAIStream(model, promptToSend, temperatureToUse, key, messagesToSend); 55 | 56 | return new Response(stream); 57 | } catch (error) { 58 | console.error(error); 59 | if (error instanceof OpenAIError) { 60 | return new Response('Error', { status: 500, statusText: error.message }); 61 | } else { 62 | return new Response('Error', { status: 500 }); 63 | } 64 | } 65 | }; 66 | 67 | export default handler; 68 | -------------------------------------------------------------------------------- /src/web/pages/api/dsensei/answer.ts: -------------------------------------------------------------------------------- 1 | import { type QuestionBody } from '@/types/chat'; 2 | 3 | import { type NextApiRequest, type NextApiResponse } from 'next'; 4 | import dataQuestionAgent from '@/../agent/data-question-agent'; 5 | import ResultBuilder from '@/../utils/result-builder'; 6 | 7 | const handler = async (req: NextApiRequest, res: NextApiResponse): Promise => { 8 | const { question, conversationId, providedAssumptions } = req.body as QuestionBody; 9 | 10 | const answer = await dataQuestionAgent.answer(question, conversationId, providedAssumptions); 11 | res.json({ 12 | question, 13 | query: answer.query, 14 | assumption: answer.assumptions, 15 | answer: answer.answer, 16 | resultData: answer.rows ? ResultBuilder.buildFromRows(answer.rows).fullCsvContent : '', 17 | hasResult: answer.hasResult, 18 | err: answer.err 19 | }) 20 | }; 21 | 22 | export default handler; 23 | -------------------------------------------------------------------------------- /src/web/pages/api/dsensei/run-query.ts: -------------------------------------------------------------------------------- 1 | import { type NextApiRequest, type NextApiResponse } from 'next'; 2 | import dataSource from '@/../datasource'; 3 | import { type Query } from '@/types/query'; 4 | import ResultBuilder from '@/../utils/result-builder'; 5 | 6 | const handler = async (req: NextApiRequest, res: NextApiResponse): Promise => { 7 | const { query } = req.body as Query; 8 | 9 | try { 10 | const result = await dataSource.runQuery(query); 11 | res.json({ 12 | query, 13 | resultData: result.rows ? ResultBuilder.buildFromRows(result.rows).fullCsvContent : '', 14 | hasResult: result.hasResult 15 | }); 16 | } catch (e) { 17 | res.json({ 18 | query, 19 | hasResult: false, 20 | err: `${e}` 21 | }); 22 | } 23 | }; 24 | 25 | export default handler; 26 | -------------------------------------------------------------------------------- /src/web/pages/api/dsensei/schemas.ts: -------------------------------------------------------------------------------- 1 | import { type NextApiRequest, type NextApiResponse } from 'next'; 2 | import dataSource from '@/../datasource'; 3 | 4 | const handler = async (req: NextApiRequest, res: NextApiResponse): Promise => { 5 | const tables = dataSource.getTables(); 6 | res.json(tables); 7 | }; 8 | 9 | export default handler; 10 | -------------------------------------------------------------------------------- /src/web/pages/api/home/home.context.tsx: -------------------------------------------------------------------------------- 1 | import { type Dispatch, createContext } from 'react'; 2 | 3 | import { type ActionType } from '@/hooks/useCreateReducer'; 4 | 5 | import { type Conversation } from '@/types/chat'; 6 | import { type KeyValuePair } from '@/types/data'; 7 | import { type FolderType } from '@/types/folder'; 8 | 9 | import { type HomeInitialState } from './home.state'; 10 | 11 | export interface HomeContextProps { 12 | state: HomeInitialState 13 | dispatch: Dispatch> 14 | handleNewConversation: () => void 15 | handleCreateFolder: (name: string, type: FolderType) => void 16 | handleDeleteFolder: (folderId: string) => void 17 | handleUpdateFolder: (folderId: string, name: string) => void 18 | handleSelectConversation: (conversation: Conversation) => void 19 | handleUpdateConversation: ( 20 | conversation: Conversation, 21 | data: KeyValuePair, 22 | ) => void 23 | } 24 | 25 | const HomeContext = createContext(undefined!); 26 | 27 | export default HomeContext; 28 | -------------------------------------------------------------------------------- /src/web/pages/api/home/home.state.tsx: -------------------------------------------------------------------------------- 1 | import { type Conversation, type Message } from '@/types/chat'; 2 | import { type ErrorMessage } from '@/types/error'; 3 | import { type FolderInterface } from '@/types/folder'; 4 | import { type OpenAIModel, type OpenAIModelID } from '@/types/openai'; 5 | import { type PluginKey } from '@/types/plugin'; 6 | import { type Prompt } from '@/types/prompt'; 7 | 8 | export interface HomeInitialState { 9 | apiKey: string 10 | pluginKeys: PluginKey[] 11 | loading: boolean 12 | lightMode: 'light' | 'dark' 13 | messageIsStreaming: boolean 14 | modelError: ErrorMessage | null 15 | models: OpenAIModel[] 16 | folders: FolderInterface[] 17 | conversations: Conversation[] 18 | selectedConversation: Conversation | undefined 19 | currentMessage: Message | undefined 20 | prompts: Prompt[] 21 | temperature: number 22 | showChatbar: boolean 23 | showPromptbar: boolean 24 | currentFolder: FolderInterface | undefined 25 | messageError: boolean 26 | searchTerm: string 27 | defaultModelId: OpenAIModelID | undefined 28 | serverSideApiKeyIsSet: boolean 29 | serverSidePluginKeysSet: boolean 30 | showSchemasDialog: boolean 31 | } 32 | 33 | export const initialState: HomeInitialState = { 34 | apiKey: '', 35 | loading: false, 36 | pluginKeys: [], 37 | lightMode: 'dark', 38 | messageIsStreaming: false, 39 | modelError: null, 40 | models: [], 41 | folders: [], 42 | conversations: [], 43 | selectedConversation: undefined, 44 | currentMessage: undefined, 45 | prompts: [], 46 | temperature: 1, 47 | showPromptbar: true, 48 | showChatbar: true, 49 | currentFolder: undefined, 50 | messageError: false, 51 | searchTerm: '', 52 | defaultModelId: undefined, 53 | serverSideApiKeyIsSet: false, 54 | serverSidePluginKeysSet: false, 55 | showSchemasDialog: false 56 | }; 57 | -------------------------------------------------------------------------------- /src/web/pages/api/home/index.ts: -------------------------------------------------------------------------------- 1 | export { default, getServerSideProps } from './home'; 2 | -------------------------------------------------------------------------------- /src/web/pages/api/models.ts: -------------------------------------------------------------------------------- 1 | import { OPENAI_API_HOST, OPENAI_API_TYPE, OPENAI_API_VERSION, OPENAI_ORGANIZATION } from '@/utils/app/const'; 2 | 3 | import { type OpenAIModel, OpenAIModelID, OpenAIModels } from '@/types/openai'; 4 | 5 | export const config = { 6 | runtime: 'edge' 7 | }; 8 | 9 | const handler = async (req: Request): Promise => { 10 | try { 11 | const { key } = (await req.json()) as { 12 | key: string 13 | }; 14 | 15 | let url = `${OPENAI_API_HOST}/v1/models`; 16 | if (OPENAI_API_TYPE === 'azure') { 17 | url = `${OPENAI_API_HOST}/openai/deployments?api-version=${OPENAI_API_VERSION}`; 18 | } 19 | 20 | const response = await fetch(url, { 21 | headers: { 22 | 'Content-Type': 'application/json', 23 | ...(OPENAI_API_TYPE === 'openai' && { 24 | Authorization: `Bearer ${key || process.env.OPENAI_API_KEY}` 25 | }), 26 | ...(OPENAI_API_TYPE === 'azure' && { 27 | 'api-key': `${key || process.env.OPENAI_API_KEY}` 28 | }), 29 | ...((OPENAI_API_TYPE === 'openai' && OPENAI_ORGANIZATION) && { 30 | 'OpenAI-Organization': OPENAI_ORGANIZATION 31 | }) 32 | } 33 | }); 34 | 35 | if (response.status === 401) { 36 | return new Response(response.body, { 37 | status: 500, 38 | headers: response.headers 39 | }); 40 | } else if (response.status !== 200) { 41 | console.error( 42 | `OpenAI API returned an error ${ 43 | response.status 44 | }: ${await response.text()}` 45 | ); 46 | throw new Error('OpenAI API returned an error'); 47 | } 48 | 49 | const json = await response.json(); 50 | 51 | const models: OpenAIModel[] = json.data 52 | // eslint-disable-next-line array-callback-return 53 | .map((model: any) => { 54 | const modelName = (OPENAI_API_TYPE === 'azure') ? model.model : model.id; 55 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 56 | for (const [_s, value] of Object.entries(OpenAIModelID)) { 57 | if (value === modelName) { 58 | return { 59 | id: model.id, 60 | name: OpenAIModels[value].name 61 | }; 62 | } 63 | } 64 | }) 65 | .filter(Boolean); 66 | 67 | return new Response(JSON.stringify(models), { status: 200 }); 68 | } catch (error) { 69 | console.error(error); 70 | return new Response('Error', { status: 500 }); 71 | } 72 | }; 73 | 74 | export default handler; 75 | -------------------------------------------------------------------------------- /src/web/pages/index.tsx: -------------------------------------------------------------------------------- 1 | export { default, getServerSideProps } from './api/home'; 2 | -------------------------------------------------------------------------------- /src/web/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/src/web/public/favicon.ico -------------------------------------------------------------------------------- /src/web/public/locales/ar/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": " (أوبن أيه أي) OpenAI API Key (مطلوب (مفتاح واجهة برمجة تطبيقات ", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "يرجى تعيين مفتاح واجهة برمجة تطبيقات أوبن أيه أي الخاص بك في الجزء السفلي الأيسر من الشريط الجانبي", 4 | "Stop Generating": "إيقاف التوليد", 5 | "Prompt limit is {{maxLength}} characters": "حرفًا {{maxLength}} حد المطالبة هو", 6 | "System Prompt": "مطالبة النظام", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "أنت شات جبت نموذج لغة كبير تم تدريبه بواسطة أوبن أيه أي. اتبع تعليمات المستخدم بعناية. الرد باستخدام الماركداون", 8 | "Enter a prompt": "أدخل المطالبة", 9 | "Regenerate response": "إعادة توليد الرد", 10 | "Sorry, there was an error.": "عذرًا، حدث خطأ", 11 | "Model": "النموذج", 12 | "Conversation": "المحادثة", 13 | "OR": "أو", 14 | "Loading...": "...جاري التحميل", 15 | "Type a message...": "...اكتب رسالة", 16 | "Error fetching models.": "خطأ في جلب النماذج", 17 | "AI": "الذكاء الاصطناعي", 18 | "You": "أنت", 19 | "Cancel": "Cancel", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "تأكد من تعيين مفتاح واجهة برمجة تطبيقات الخاص بك في الجزء السفلي الأيسر من الشريط", 22 | "If you completed this step, OpenAI may be experiencing issues.": "من مشاكل OpenAI إذا اكتملت هذه الخطوة، فقد يعاني", 23 | 24 | "click if using a .env.local file": ".env.local انقر إذا كنت تستخدم ملف", 25 | 26 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "حرفًا {{maxLength}} حد الرسالة هو {{valueLength}} لقد أدخلت ", 27 | 28 | "Please enter a message": "يرجى إدخال رسالة", 29 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI هي مجموعة متقدمة للدردشة تستخدم", 30 | "Are you sure you want to clear all messages?": "هل أنت متأكد أنك تريد مسح كافة الرسائل؟", 31 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "القيم الأعلى مثل 0.8 ستجعل الإخراج أكثر عشوائية، في حين أن القيم الأقل مثل 0.2 ستجعله أكثر تركيزًا وتحديدًا." 32 | } 33 | -------------------------------------------------------------------------------- /src/web/public/locales/ar/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/ar/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "نسخ الكود", 3 | "Copied!": "تم النسخ!", 4 | "Enter file name": "أدخل اسم الملف" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/ar/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "مطلب جديد", 3 | "New folder": "مجلد جديد", 4 | "No prompts.": "لا يوجد مطالبات.", 5 | "Search prompts...": "...البحث عن مطالبات", 6 | "Name": "الاسم", 7 | "Description": "الوصف", 8 | "A description for your prompt.": "وصف لمطلبك", 9 | "Prompt": "مطلب", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "محتوى المطلب. استخدم {{}} للإشارة إلى متغير. مثال: {{الاسم}} هي {{صفة}} {{اسم}}", 11 | "Save": "حفظ" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/ar/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "الوضع الداكن", 3 | "Light mode": "الوضع الفاتح" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/ar/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "مجلد جديد", 3 | "New chat": "محادثة جديدة", 4 | "No conversations.": "لا يوجد محادثات", 5 | "Search conversations...": "...البحث عن المحادثات", 6 | "OpenAI API Key": " (أوبن أيه أي) OpenAI API Key (مفتاح واجهة برمجة تطبيقات)", 7 | "Import data": "استيراد المحادثات", 8 | "Are you sure?": "هل أنت متأكد؟", 9 | "Clear conversations": "مسح المحادثات", 10 | "Export data": "تصدير المحادثات", 11 | "Dark mode": "الوضع الداكن", 12 | "Light mode": "الوضع الفاتح" 13 | } 14 | -------------------------------------------------------------------------------- /src/web/public/locales/bn/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "OpenAI API key বাধ্যতামূলক", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "দয়া করে আপনার OpenAI API key বামে সাইডবারের নিচের দিকে সেট করুন।", 4 | "Stop Generating": "বার্তা জেনারেট করা বন্ধ করুন", 5 | "Prompt limit is {{maxLength}} characters": "নির্দেশনা (বার্তা) সীমা সর্বোচ্চ {{maxLength}} অক্ষর", 6 | "System Prompt": "সিস্টেম নির্দেশনা (বার্তা)", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "তুমি ChatGPT, OpenAI দ্বারা প্রশিক্ষিত একটি বড় ভাষা মডেল। সাবধানে ব্যবহারকারীর নির্দেশাবলী অনুসরণ করুন. মার্কডাউন ব্যবহার করে উত্তর দিন।", 8 | "Enter a prompt": "একটি নির্দেশনা (বার্তা) দিন", 9 | "Regenerate response": "বার্তা আবার জেনারেট করুন", 10 | "Sorry, there was an error.": "দুঃখিত, কোনো একটি সমস্যা হয়েছে।", 11 | "Model": "মডেল", 12 | "Conversation": "আলাপচারিতা", 13 | "OR": "অথবা", 14 | "Loading...": "লোড হচ্ছে...", 15 | "Type a message...": "কোনো মেসেজ লিখুন...", 16 | "Error fetching models.": "মডেল পেতে সমস্যা হচ্ছে।", 17 | "AI": "AI", 18 | "You": "তুমি", 19 | "Cancel": "বাতিল করুন", 20 | "Save & Submit": "সংরক্ষণ করুন এবং জমা দিন", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "নিশ্চিত করুন যে আপনার OpenAI API key সাইডবারের নীচে বাম দিকে সেট করা আছে।", 22 | "If you completed this step, OpenAI may be experiencing issues.": "আপনি এই ধাপটি সম্পন্ন করে থাকলে, হতে পারে যে OpenAI কোনো সমস্যার সম্মুখীন হয়েছে।", 23 | "click if using a .env.local file": "একটি .env.local ফাইল ব্যবহার করলে এখানে ক্লিক করুন", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "বার্তার সর্বোচ্চ সীমা হল {{maxLength}} অক্ষর৷ আপনি {{valueLength}} অক্ষর লিখেছেন।", 25 | "Please enter a message": "দয়া করে একটি মেসেজ লিখুন", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI হল OpenAI-এর চ্যাট মডেলগুলির জন্য একটি উন্নত চ্যাটবট কিট যার লক্ষ্য হল ChatGPT-এর ইন্টারফেস এবং কার্যকারিতা অনুকরণ করা।", 27 | "Are you sure you want to clear all messages?": "সমস্ত বার্তা মুছে ফেলতে আপনি কি নিশ্চিত?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "০.৮ এর বেশি মান দিলে আউটপুট বেশি ইউনিক হবে, যেহেতু ০.২ এর মতো নিম্নমানের মান দিলে তা আরও ফোকাস এবং ধারাবাহিকতা বজায় থাকবে এবং নিশ্চয়তামূলক হবে।" 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/bn/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/bn/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "কোড কপি করুন", 3 | "Copied!": "কপি করা হয়েছে!", 4 | "Enter file name": "ফাইল নাম লিখুন" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/bn/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "নতুন prompt", 3 | "New folder": "নতুন ফোল্ডার", 4 | "No prompts.": "কোনো prompts নেই।", 5 | "Search prompts...": "prompts অনুসন্ধান হচ্ছে...", 6 | "Name": "নাম", 7 | "Description": "বর্ণনা", 8 | "A description for your prompt.": "আপনার Prompt জন্য একটি বিবরণ লিখুন.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}", 11 | "Save": "সংরক্ষণ করুন" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/bn/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "ডার্ক মোড", 3 | "Light mode": "লাইট মোড" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/bn/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "নতুন ফোল্ডার", 3 | "New chat": "নতুন আড্ডা", 4 | "No conversations.": "কোনো আলাপচারিতা নেই।", 5 | "Search conversations...": "আলাপচারিতা খুঁজুন...", 6 | "OpenAI API Key": "OpenAI API Key", 7 | "Import data": "আলাপচারিতা ইমপোর্ট", 8 | "Are you sure?": "আপনি কি নিশ্চিত?", 9 | "Clear conversations": "কথোপকথন পরিষ্কার করুন", 10 | "Export data": "আলাপচারিতা এক্সপোর্ট" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/ca/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "Cal la clau d'API d'OpenAI", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Si us plau, introdueix la teva clau d'API d'OpenAI a la cantonada inferior esquerra de la barra lateral.", 4 | "Stop Generating": "Parar de generar", 5 | "Prompt limit is {{maxLength}} characters": "El límit del missatge és de {{maxLength}} caràcters", 6 | "System Prompt": "Missatge del sistema", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Ets ChatGPT, un model de llenguatge gran entrenat per OpenAI. Segueix les instruccions de l'usuari amb cura. Respon utilitzant markdown.", 8 | "Enter a prompt": "Introdueix un missatge", 9 | "Regenerate response": "Regenerar resposta", 10 | "Sorry, there was an error.": "Ho sentim, ha ocorregut un error.", 11 | "Model": "Model", 12 | "Conversation": "Conversa", 13 | "OR": "O", 14 | "Loading...": "Carregant...", 15 | "Type a message...": "Escriu un missatge...", 16 | "Error fetching models.": "Error en obtenir els models.", 17 | "AI": "IA", 18 | "You": "Tu", 19 | "Cancel": "Cancel·lar", 20 | "Save & Submit": "Guardar i enviar", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Assegura't que has introduït la clau d'API d'OpenAI a la cantonada inferior esquerra de la barra lateral.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Si has completat aquest pas, OpenAI podria estar experimentant problemes.", 23 | "click if using a .env.local file": "fes clic si estàs utilitzant un fitxer .env.local", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "El límit del missatge és de {{maxLength}} caràcters. Has introduït {{valueLength}} caràcters.", 25 | "Please enter a message": "Si us plau, introdueix un missatge", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI és un kit avançat de chatbot per als models de xat d'OpenAI que busca imitar la interfície i funcionalitat de ChatGPT.", 27 | "Are you sure you want to clear all messages?": "Estàs segur que vols esborrar tots els missatges?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "Valors més alts com 0,8 faran que la sortida sigui més aleatòria, mentre que valors més baixos com 0,2 la faran més enfocada i determinista." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/ca/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/ca/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Copiar codi", 3 | "Copied!": "Copiat!", 4 | "Enter file name": "Introdueix el nom de l'arxiu" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/ca/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "Nou prompt", 3 | "New folder": "Nova carpeta", 4 | "No prompts.": "No hi ha prompts.", 5 | "Search prompts...": "Cerca prompts...", 6 | "Name": "Nom", 7 | "Description": "Descripció", 8 | "A description for your prompt.": "Descripció del teu prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Contingut del missatge. Utilitza {{}} per indicar una variable. Ex: {{nom}} és un {{adjectiu}} {{substantiu}}", 11 | "Save": "Guardar" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/ca/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Nova carpeta", 3 | "New chat": "Nova conversa", 4 | "No conversations.": "No hi ha converses.", 5 | "Search conversations...": "Cerca converses...", 6 | "OpenAI API Key": "Clau d'API d'OpenAI", 7 | "Import data": "Importar converses", 8 | "Are you sure?": "Estàs segur?", 9 | "Clear conversations": "Esborrar converses", 10 | "Export data": "Exportar converses", 11 | "Dark mode": "Mode fosc", 12 | "Light mode": "Mode clar" 13 | } 14 | -------------------------------------------------------------------------------- /src/web/public/locales/de/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "OpenAI API-Schlüssel erforderlich", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Bitte trage deinen OpenAI API-Schlüssel in der linken unteren Ecke der Seitenleiste ein.", 4 | "Stop Generating": "Generieren stoppen", 5 | "Prompt limit is {{maxLength}} characters": "Das Eingabelimit liegt bei {{maxLength}} Zeichen", 6 | "System Prompt": "Systemaufforderung", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Du bist ChatGPT, ein großes Sprachmodell, das von OpenAI trainiert wurde. Befolge die Anweisungen des Benutzers sorgfältig. Antworte in Markdown-Format.", 8 | "Enter a prompt": "Gib eine Anweisung ein", 9 | "Regenerate response": "Antwort erneut generieren", 10 | "Sorry, there was an error.": "Entschuldigung, es ist ein Fehler aufgetreten.", 11 | "Model": "Modell", 12 | "Conversation": "Konversation", 13 | "OR": "ODER", 14 | "Loading...": "Laden...", 15 | "Type a message...": "Schreibe eine Nachricht...", 16 | "Error fetching models.": "Fehler beim Abrufen der Sprachmodelle.", 17 | "AI": "KI", 18 | "You": "Du", 19 | "Cancel": "Cancel", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Stelle sicher, dass dein OpenAI API-Schlüssel in der unteren linken Ecke der Seitenleiste eingetragen ist.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Wenn dies der Fall ist, könnte OpenAI möglicherweise momentan Probleme haben.", 23 | "click if using a .env.local file": "click if using a .env.local file", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "Das Nachrichtenlimit beträgt {{maxLength}} Zeichen. Du hast bereits {{valueLength}} Zeichen eingegeben.", 25 | "Please enter a message": "Bitte gib eine Nachricht ein", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI ist ein fortschrittliches Chatbot-Toolkit für OpenAI's Chat-Modelle, das darauf abzielt, die Benutzeroberfläche und Funktionalität von ChatGPT nachzuahmen.", 27 | "Are you sure you want to clear all messages?": "Bist du sicher, dass du alle Nachrichten löschen möchtest?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "Höhere Werte wie 0,8 machen die Ausgabe zufälliger, während niedrigere Werte wie 0,2 sie fokussierter und deterministischer machen werden." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/de/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/de/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Code kopieren", 3 | "Copied!": "Kopiert!", 4 | "Enter file name": "Dateinamen eingeben" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/de/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "New prompt", 3 | "New folder": "New folder", 4 | "No prompts.": "No prompts.", 5 | "Search prompts...": "Search prompts...", 6 | "Name": "Name", 7 | "Description": "Description", 8 | "A description for your prompt.": "A description for your prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}", 11 | "Save": "Save" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/de/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Dark Mode", 3 | "Light mode": "Light Mode" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/de/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Neuer Ordner", 3 | "New chat": "Neue Konversation", 4 | "No conversations.": "Keine Konversationen.", 5 | "Search conversations...": "Konversationen suchen...", 6 | "OpenAI API Key": "OpenAI API-Schlüssel", 7 | "Import data": "Konversationen importieren", 8 | "Are you sure?": "Bist du sicher?", 9 | "Clear conversations": "Konversationen löschen", 10 | "Export data": "Konversationen exportieren" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/en/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/es/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "Se requiere la clave de API de OpenAI", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Por favor, ingrese su clave de API de OpenAI en la esquina inferior izquierda de la barra lateral.", 4 | "Stop Generating": "Dejar de generar", 5 | "Prompt limit is {{maxLength}} characters": "El límite del mensaje es de {{maxLength}} caracteres", 6 | "System Prompt": "Mensaje del sistema", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Eres ChatGPT, un modelo de lenguaje grande entrenado por OpenAI. Sigue las instrucciones del usuario cuidadosamente. Responde usando markdown.", 8 | "Enter a prompt": "Ingrese un mensaje", 9 | "Regenerate response": "Regenerar respuesta", 10 | "Sorry, there was an error.": "Lo sentimos, ha ocurrido un error.", 11 | "Model": "Modelo", 12 | "Conversation": "Conversación", 13 | "OR": "O", 14 | "Loading...": "Cargando...", 15 | "Type a message...": "Escriba un mensaje...", 16 | "Error fetching models.": "Error al obtener los modelos.", 17 | "AI": "IA", 18 | "You": "Tú", 19 | "Cancel": "Cancel", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Asegúrate de que hayas ingresado la clave de API de OpenAI en la esquina inferior izquierda de la barra lateral.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Si completaste este paso, OpenAI podría estar experimentando problemas.", 23 | "click if using a .env.local file": "haz clic si estás utilizando un archivo .env.local", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "El límite del mensaje es de {{maxLength}} caracteres. Has ingresado {{valueLength}} caracteres.", 25 | "Please enter a message": "Por favor, ingrese un mensaje", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI es un kit avanzado de chatbot para los modelos de chat de OpenAI que busca imitar la interfaz y funcionalidad de ChatGPT.", 27 | "Are you sure you want to clear all messages?": "¿Está seguro de que desea borrar todos los mensajes?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "Valores más altos como 0,8 harán que la salida sea más aleatoria, mientras que valores más bajos como 0,2 la harán más enfocada y determinista." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/es/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/es/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Copiar código", 3 | "Copied!": "¡Copiado!", 4 | "Enter file name": "Ingrese el nombre del archivo" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/es/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "Nuevo prompt", 3 | "New folder": "Nueva carpeta", 4 | "No prompts.": "No hay prompts.", 5 | "Search prompts...": "Buscar prompts...", 6 | "Name": "Nombre", 7 | "Description": "Descripción", 8 | "A description for your prompt.": "Descripción de su prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Contenido del prompt. Utilice {{}} para indicar una variable. Ej: {{nombre}} es un {{adjetivo}} {{nombre}}", 11 | "Save": "Guardar" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/es/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Modo oscuro", 3 | "Light mode": "Modo claro" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/es/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Nueva carpeta", 3 | "New chat": "Nueva conversación", 4 | "No conversations.": "No hay conversaciones.", 5 | "Search conversations...": "Buscar conversaciones...", 6 | "OpenAI API Key": "Llave de API de OpenAI", 7 | "Import data": "Importar conversaciones", 8 | "Are you sure?": "¿Estás seguro?", 9 | "Clear conversations": "Borrar conversaciones", 10 | "Export data": "Exportar conversaciones" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/fi/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "OpenAI API-avain tarvitaan", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Ole hyvä ja aseta OpenAI API-avaimesi sivupalkin vasemmassa alareunassa.", 4 | "Stop Generating": "Lopeta generointi", 5 | "Prompt limit is {{maxLength}} characters": "Promptin maksimipituus on {{maxLength}} merkkiä", 6 | "System Prompt": "System prompt", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Sinä olet ChatGPT, OpenAI:n opettama laaja kielimalli. Seuraa käyttäjän ohjeita tarkasti. Vastaa käyttäen markdownia.", 8 | "Enter a prompt": "Syötä prompti", 9 | "Regenerate response": "Luo vastaus uudelleen", 10 | "Sorry, there was an error.": "Valitettavasti tapahtui virhe.", 11 | "Model": "Malli", 12 | "Conversation": "Keskustelu", 13 | "OR": "TAI", 14 | "Loading...": "Ladataan...", 15 | "Type a message...": "Kirjoita viesti...", 16 | "Type a message or type \"/\" to select a prompt...": "Kirjoita viesti tai \"/\" valitaksesi promptin...", 17 | "Error fetching models.": "Virhe malleja haettaessa.", 18 | "AI": "AI", 19 | "You": "Sinä", 20 | "Cancel": "Peruuta", 21 | "Save & Submit": "Tallenna & Lähetä", 22 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Varmista että OpenAI API-avaimesi on asetettu sivupalkin vasemmassa alareunassa.", 23 | "If you completed this step, OpenAI may be experiencing issues.": "Jos olet suorittanut tämän kohdan, OpenAI:lla saattaa olla tällä hetkellä ongelmia.", 24 | "click if using a .env.local file": "klikkaa jos käytät .env.local-tiedostoa", 25 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "Viestin maksimipituus on {{maxLength}} merkkiä. Olet käyttänyt {{valueLength}} merkkiä.", 26 | "Please enter a message": "Ole hyvä ja syötä viesti", 27 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI on OpenAI:n keskustelumalleille tarkoitettu käyttöliittymä joka pyrkii jäljittelemään ChatGPT:n käyttöliittymää ja toiminnallisuuksia.", 28 | "Are you sure you want to clear all messages?": "Haluatko varmasti poistaa kaikki viestit?", 29 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "Suuremmat arvot kuten 0.8 tekevät vastauksista satunnaisempia, kun taas pienemmät arvot kuten 0.2 tekevät niistä keskittyneempiä ja johdonmukaisempia.", 30 | "Precise": "Tarkka", 31 | "Neutral": "Neutraali", 32 | "Creative": "Luova", 33 | "View Account Usage": "Näytä tilin käyttötilastot", 34 | "Search...": "Hae..." 35 | } 36 | -------------------------------------------------------------------------------- /src/web/public/locales/fi/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/fi/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Kopioi koodi", 3 | "Copied!": "Kopioitu!", 4 | "Enter file name": "Syötä tiedostonimi" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/fi/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "Uusi prompt", 3 | "New folder": "Uusi kansio", 4 | "No prompts.": "Ei prompteja.", 5 | "Search prompts...": "Hae prompteista...", 6 | "Name": "Nimi", 7 | "Description": "Kuvaus", 8 | "A description for your prompt.": "Promptisi kuvaus.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Promptin sisältö. Käytä {{}} muuttujien merkitsemiseen. Esim: {{nimi}} on {{adjektiivi}} {{substantiivi}}", 11 | "Save": "Tallenna" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/fi/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Settings": "Asetukset", 3 | "Theme": "Teema", 4 | "Dark mode": "Tumma teema", 5 | "Light mode": "Vaalea teema", 6 | "Save": "Tallenna" 7 | } 8 | -------------------------------------------------------------------------------- /src/web/public/locales/fi/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Uusi kansio", 3 | "New chat": "Uusi keskustelu", 4 | "No conversations.": "Ei keskusteluja.", 5 | "Search conversations...": "Hae keskusteluista...", 6 | "OpenAI API Key": "OpenAI API-avain", 7 | "Import data": "Tuo keskusteluita", 8 | "Are you sure?": "Oletko varma?", 9 | "Clear conversations": "Tyhjennä keskustelut", 10 | "Export data": "Vie keskustelut", 11 | "Settings": "Asetukset", 12 | "Plugin Keys": "Plugin-avaimet" 13 | } 14 | -------------------------------------------------------------------------------- /src/web/public/locales/fr/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "Clé API OpenAI requise", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Veuillez saisir votre clé API OpenAI dans le coin inférieur gauche de la barre latérale.", 4 | "Stop Generating": "Interrompre la génération", 5 | "Prompt limit is {{maxLength}} characters": "La limite du prompt est de {{maxLength}} caractères", 6 | "System Prompt": "Prompt du système", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Vous êtes ChatGPT, un grand modèle linguistique entraîné par OpenAI. Suivez attentivement les instructions de l'utilisateur. Répondez en utilisant Markdown.", 8 | "Enter a prompt": "Entrez un prompt", 9 | "Regenerate response": "Régénérer la réponse", 10 | "Sorry, there was an error.": "Désolé, une erreur est survenue.", 11 | "Model": "Modèle", 12 | "Conversation": "Conversation", 13 | "OR": "OU", 14 | "Loading...": "Chargement...", 15 | "Type a message...": "Tapez un message...", 16 | "Error fetching models.": "Erreur lors de la récupération des modèles.", 17 | "AI": "IA", 18 | "You": "Vous", 19 | "Cancel": "Cancel", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Assurez-vous que votre clé API OpenAI est définie dans le coin inférieur gauche de la barre latérale.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Si vous avez effectué cette étape, OpenAI peut rencontrer des problèmes.", 23 | "click if using a .env.local file": "click if using a .env.local file", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "La limite de message est de {{maxLength}} caractères. Vous avez saisi {{valueLength}} caractères.", 25 | "Please enter a message": "Veuillez entrer un message", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI est un kit de chatbot avancé pour les modèles de chat d'OpenAI visant à imiter l'interface et les fonctionnalités de ChatGPT.", 27 | "Are you sure you want to clear all messages?": "Êtes-vous sûr de vouloir effacer tous les messages ?" 28 | } 29 | -------------------------------------------------------------------------------- /src/web/public/locales/fr/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/fr/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Copier le code", 3 | "Copied!": "Copié !", 4 | "Enter file name": "Entrez le nom du fichier" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/fr/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "New prompt", 3 | "New folder": "New folder", 4 | "No prompts.": "No prompts.", 5 | "Search prompts...": "Search prompts...", 6 | "Name": "Name", 7 | "Description": "Description", 8 | "A description for your prompt.": "A description for your prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}", 11 | "Save": "Save" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/fr/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Mode sombre", 3 | "Light mode": "Mode clair" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/fr/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Nouveau dossier", 3 | "New chat": "Nouvelle discussion", 4 | "No conversations.": "Aucune conversation.", 5 | "Search conversations...": "Rechercher des conversations...", 6 | "OpenAI API Key": "Clé API OpenAI", 7 | "Import data": "Importer des conversations", 8 | "Are you sure?": "Êtes-vous sûr ?", 9 | "Clear conversations": "Effacer les conversations", 10 | "Export data": "Exporter les conversations" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/he/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "מפתח openAI API", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "עליך להזין את המפתח האישי שלך בצידו השמאלי התחתון של תפריט הניווט.", 4 | "Stop Generating": "עצור תהליך הפקת התשובה", 5 | "Prompt limit is {{maxLength}} characters": "אורך התשובה מוגבל ל {{maxLength}} תווים", 6 | "System Prompt": "הגדרת בסיס לכל תשובה של המערכת", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "You are Hebrew speaking ChatGPT, a large language model trained by OpenAI which responds in Hebrew to any question or User comment. Follow the user's instructions carefully. Respond in Hebrew using markdown.", 8 | "Enter a prompt": "הקלד הודעה", 9 | "Regenerate response": "הפק תשובה מחדש", 10 | "Sorry, there was an error.": "התנצלותנו הכנה, המערכת מדווחת על תקלה", 11 | "Model": "מודל", 12 | "Conversation": "שיחה", 13 | "OR": "או", 14 | "Loading...": "טוען...", 15 | "Type a message...": "הקלד הודעתך...", 16 | "Error fetching models.": "תקלה באיחזור רשימת המודלים", 17 | "AI": "המערכת", 18 | "You": "אתה", 19 | "Cancel": "Cancel", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "עליך לוודא שמפתח האישי שלך מוזן בתפריט מצד שמאל", 22 | "If you completed this step, OpenAI may be experiencing issues.": "אם טרם השלמת חלק זה יש סבירות גבוהה להתרחשות תקלה", 23 | "click if using a .env.local file": "click if using a .env.local file", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "מגבלת תווים היא {{maxLength}}. אתה הקלדת עד עכשיו {{valueLength}} תווים.", 25 | "Please enter a message": "הקלד את הודעתך", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "מערכת הצאטבוט היא ערכה מתקדמת לניהול שיחה המכוונת לחקות את המראה והפונקציונאלית של ChatGPT", 27 | "Are you sure you want to clear all messages?": "האם אתה בטוח שברצונך למחוק את כל ההודעות?" 28 | } 29 | -------------------------------------------------------------------------------- /src/web/public/locales/he/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/he/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "העתק קוד", 3 | "Copied!": "נשמר בזכרון", 4 | "Enter file name": "הקלד שם לקובץ" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/he/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "פקודת מכונה חדשה", 3 | "New folder": "תיקיה חדשה", 4 | "No prompts.": "לא נמצאו פקודות מכונות", 5 | "Search prompts...": "חיפוש פקודות...", 6 | "Name": "שם", 7 | "Description": "תיאור", 8 | "A description for your prompt.": "תיאור שורת הפקודה למכונה", 9 | "Prompt": "פקודה", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "תיאור הפקודה. השתמש {{}} להגדרת משתנים. לדוגמא {{שם משתנה}} הוא {{תואר}} {{שם עצם}}", 11 | "Save": "Save" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/he/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "מצב כהה", 3 | "Light mode": "מצב בהיר" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/he/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "תיקיה חדשה", 3 | "New chat": "שיחה חדשה", 4 | "No conversations.": "אין שיחות חדשות", 5 | "Search conversations...": "חיפוש שיחות...", 6 | "OpenAI API Key": "מפתח אישי ל openAI", 7 | "Import data": "ייבוא שיחות", 8 | "Are you sure?": "אתה בטוח?", 9 | "Clear conversations": "ניקוי שיחות", 10 | "Export data": "ייצוא שיחות" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/id/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "Memerlukan Kunci API OpenAI", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Silakan atur kunci API OpenAI Anda di bagian kiri bawah bilah sisi.", 4 | "Stop Generating": "Berhenti Menghasilkan", 5 | "Prompt limit is {{maxLength}} characters": "Batas karakter untuk prompt adalah {{maxLength}} karakter", 6 | "System Prompt": "Prompt Sistem", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Anda adalah ChatGPT, model bahasa besar yang dilatih oleh OpenAI. Ikuti instruksi pengguna dengan hati-hati. Balas menggunakan markdown.", 8 | "Enter a prompt": "Masukkan sebuah prompt", 9 | "Regenerate response": "Hasilkan kembali respons", 10 | "Sorry, there was an error.": "Maaf, terjadi kesalahan.", 11 | "Model": "Model", 12 | "Conversation": "Percakapan", 13 | "OR": "ATAU", 14 | "Loading...": "Memuat...", 15 | "Type a message...": "Ketik sebuah pesan...", 16 | "Error fetching models.": "Kesalahan dalam mengambil model.", 17 | "AI": "AI", 18 | "You": "Anda", 19 | "Cancel": "Cancel", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Pastikan kunci API OpenAI Anda diatur di bagian kiri bawah bilah sisi.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Jika Anda telah menyelesaikan langkah ini, OpenAI mungkin mengalami masalah.", 23 | "click if using a .env.local file": "klik jika menggunakan file .env.local", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "Batas karakter untuk pesan adalah {{maxLength}} karakter. Anda telah memasukkan {{valueLength}} karakter.", 25 | "Please enter a message": "Silakan masukkan sebuah pesan", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI adalah kit chatbot canggih untuk model obrolan OpenAI yang bertujuan meniru antarmuka dan fungsionalitas ChatGPT.", 27 | "Are you sure you want to clear all messages?": "Apakah Anda yakin ingin menghapus semua pesan?" 28 | } 29 | -------------------------------------------------------------------------------- /src/web/public/locales/id/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/id/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Salin kode", 3 | "Copied!": "Kode disalin!", 4 | "Enter file name": "Masukkan nama file" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/id/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "New prompt", 3 | "New folder": "New folder", 4 | "No prompts.": "No prompts.", 5 | "Search prompts...": "Search prompts...", 6 | "Name": "Name", 7 | "Description": "Description", 8 | "A description for your prompt.": "A description for your prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}", 11 | "Save": "Save" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/id/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Mode gelap", 3 | "Light mode": "Mode terang" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/id/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Folder baru", 3 | "New chat": "Percakapan baru", 4 | "No conversations.": "Tidak ada percakapan.", 5 | "Search conversations...": "Cari percakapan...", 6 | "OpenAI API Key": "Kunci API OpenAI", 7 | "Import data": "Impor percakapan", 8 | "Are you sure?": "Apakah Anda yakin?", 9 | "Clear conversations": "Hapus percakapan", 10 | "Export data": "Ekspor percakapan" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/it/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "E' richiesta la chiave API OpenAI", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Per favore, inserisci la tua Chiave API OpenAI in basso a sinistra nella barra laterale", 4 | "Stop Generating": "Interrompi la generazione", 5 | "Prompt limit is {{maxLength}} characters": "Il limite del messaggio è di {{maxLength}} caratteri", 6 | "System Prompt": "Prompt del sistema", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Sei ChatGPT, un grande modello di linguaggio addestrato da OpenAI. Segui attentamente le istruzioni dell'utente. Rispondi usando il markdown.", 8 | "Enter a prompt": "Inserisci un prompt", 9 | "Regenerate response": "Rigenera risposta", 10 | "Sorry, there was an error.": "Scusa, si è verificato un errore.", 11 | "Model": "Modello", 12 | "Conversation": "Conversazione", 13 | "OR": "O", 14 | "Loading...": "Caricamento...", 15 | "Type a message...": "Digita un messaggio...", 16 | "Error fetching models.": "Si è verificato un errore nel recupero dei modelli.", 17 | "AI": "IA", 18 | "You": "Tu", 19 | "Cancel": "Annulla", 20 | "Save & Submit": "Salva e invia", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Assicurati che la tua chiave API OpenAI sia inserita in basso a sinistra nella barra laterale", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Se hai completato questo passaggio, OpenAI potrebbe avere problemi.", 23 | "click if using a .env.local file": "Fai click se stai utilizzando un file .env.local", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "Il limite del messaggio è di {{maxLength}} caratteri. Hai inserito {{valueLength}} caratteri.", 25 | "Please enter a message": "Per favore, scrivi un messaggio", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI è un kit avanzato di chatbot per i modelli di chat di OpenAI che mira a imitare l'interfaccia e le funzionalità di ChatGPT.", 27 | "Are you sure you want to clear all messages?": "Sei sicuro di voler cancellare tutti i messaggi?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "Valori più alti come 0,8 renderanno l'output più casuale, mentre valori più bassi come 0,2 lo renderanno più focalizzato e deterministico." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/it/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/it/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Copia codice", 3 | "Copied!": "Copiato!", 4 | "Enter file name": "Inserisci il nome del file" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/it/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "Nuovo prompt", 3 | "New folder": "Nuova cartella", 4 | "No prompts.": "Nessun prompt.", 5 | "Search prompts...": "Cerca prompts...", 6 | "Name": "Nome", 7 | "Description": "Descrizione", 8 | "A description for your prompt.": "Descrizione del tuo prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Contenuto del prompt. Utilizza {{}} per indicare una variabile. Per esempio: {{nome}} è un {{aggettivo}} {{sostantivo}}", 11 | "Save": "Salva" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/it/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Modalità scura", 3 | "Light mode": "Modalità chiara" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/it/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Nuova cartella", 3 | "New chat": "Nuova conversazione", 4 | "No conversations.": "Nessuna conversazione.", 5 | "Search conversations...": "Cerca conversazioni...", 6 | "OpenAI API Key": "Chiave API OpenAI", 7 | "Import data": "Importa dati", 8 | "Are you sure?": "Sei sicuro?", 9 | "Clear conversations": "Elimina conversazioni", 10 | "Export data": "Esporta dati" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/ja/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "OpenAIのAPIキーが必要です", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "左下のサイドバーでOpenAIのAPIキーを設定してください", 4 | "Stop Generating": "回答をストップ", 5 | "Prompt limit is {{maxLength}} characters": "プロンプトの文字数は{{maxLength}}文字までです", 6 | "System Prompt": "システムのプロンプト", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "あなたはOpenAIによってトレーニングされた大規模言語モデルのChatGPTです。ユーザーの指示には注意深く従ってください。マークダウンを使用して応答してください。", 8 | "Enter a prompt": "プロンプトを入力してください", 9 | "Regenerate response": "もう一度回答する", 10 | "Sorry, there was an error.": "すみません、エラーが発生しました。", 11 | "Model": "モデル", 12 | "Conversation": "会話", 13 | "OR": "または", 14 | "Loading...": "読み込み中...", 15 | "Type a message...": "メッセージを入力...", 16 | "Error fetching models.": "モデルの取得中にエラーが発生しました。", 17 | "AI": "AI", 18 | "You": "あなた", 19 | "Cancel": "キャンセル", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "OpenAIのAPIキーがサイドバーの左下に設定されていることを確認してください。", 22 | "If you completed this step, OpenAI may be experiencing issues.": "このステップを完了した場合、OpenAIに問題が発生している可能性があります。", 23 | "click if using a .env.local file": "もし.env.localファイルを使用している場合はこちらをクリックしてください", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "メッセージの文字数は{{maxLength}}文字までです。あなたは{{valueLength}}文字を入力しました。", 25 | "Please enter a message": "メッセージを入力してください", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UIは、ChatGPTと同様のインターフェイスと機能を実現するための、チャットボットキットです。", 27 | "Are you sure you want to clear all messages?": "すべてのメッセージを削除してもよろしいですか?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "0.8のような高い値は出力をよりランダムにし、0.2のような低い値はより焦点を絞り、決定論的にします。" 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/ja/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/ja/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "コードをコピー", 3 | "Copied!": "コピーしました!", 4 | "Enter file name": "ファイル名を入力" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/ja/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "新しいプロンプト", 3 | "New folder": "新しいフォルダ", 4 | "No prompts.": "プロンプトはありません", 5 | "Search prompts...": "プロンプトの検索...", 6 | "Name": "名前", 7 | "Description": "説明", 8 | "A description for your prompt.": "プロンプトの説明", 9 | "Prompt": "プロンプト", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "プロンプトの内容。変数を表すには {{}} を使ってください。 例: {{name}} is a {{adjective}} {{noun}}", 11 | "Save": "保存" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/ja/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Settings": "設定", 3 | "Theme": "テーマ", 4 | "Save": "保存", 5 | "Dark mode": "ダークモード", 6 | "Light mode": "ライトモード" 7 | } 8 | -------------------------------------------------------------------------------- /src/web/public/locales/ja/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "新規フォルダ", 3 | "New chat": "新規チャット", 4 | "No conversations.": "会話履歴はありません。", 5 | "Search conversations...": "会話を検索...", 6 | "OpenAI API Key": "OpenAI APIキー", 7 | "Import data": "会話履歴をインポート", 8 | "Are you sure?": "よろしいですか?", 9 | "Clear conversations": " 会話をクリア", 10 | "Export data": "会話履歴をエクスポート", 11 | "Dark mode": "ダークモード", 12 | "Light mode": "ライトモード", 13 | "Settings": "設定" 14 | } 15 | -------------------------------------------------------------------------------- /src/web/public/locales/ko/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "OpenAI API 키가 필요합니다", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "사이드바 왼쪽 하단에 OpenAI API 키를 설정하세요.", 4 | "Stop Generating": "생성 중지", 5 | "Prompt limit is {{maxLength}} characters": "프롬프트 제한은 {{maxLength}}자입니다", 6 | "System Prompt": "시스템 프롬트", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "당신은 OpenAI에서 훈련된 대규모 언어 모델 ChatGPT입니다. 사용자의 지시를 주의해서 따르세요. 마크다운을 사용하여 응답하세요.", 8 | "Enter a prompt": "프롬프트를 입력하세요", 9 | "Regenerate response": "응답 재생성", 10 | "Sorry, there was an error.": "죄송합니다, 오류가 발생했습니다.", 11 | "Model": "모델", 12 | "Conversation": "대화", 13 | "OR": "또는", 14 | "Loading...": "로드 중...", 15 | "Type a message...": "메시지를 입력하세요...", 16 | "Error fetching models.": "모델을 가져오는 중 오류가 발생했습니다.", 17 | "AI": "인공지능", 18 | "You": "당신", 19 | "Cancel": "Cancel", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "OpenAI API 키가 사이드바 왼쪽 하단에 설정되어 있는지 확인하세요.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "이 단계를 완료한 경우 OpenAI에 문제가 있을 수도 있습니다.", 23 | "click if using a .env.local file": "click if using a .env.local file", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "메시지 제한은 {{maxLength}}자입니다. {{valueLength}}자를 입력했습니다.", 25 | "Please enter a message": "메시지를 입력하세요", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI는 ChatGPT의 인터페이스와 기능을 모방하는 것을 목표로 둔 OpenAI의 채팅 모델들을 위한 고급 챗봇 키트입니다.", 27 | "Are you sure you want to clear all messages?": "모든 메시지를 지우시겠습니까?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "0.8과 같은 높은 값은 출력을 더 무작위로 만들고, 0.2와 같은 낮은 값은 더 집중적이고 결정론적으로 만들어줍니다." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/ko/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/ko/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "코드 복사", 3 | "Copied!": "복사 완료!", 4 | "Enter file name": "파일 이름을 입력하세요" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/ko/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "New prompt", 3 | "New folder": "New folder", 4 | "No prompts.": "No prompts.", 5 | "Search prompts...": "Search prompts...", 6 | "Name": "Name", 7 | "Description": "Description", 8 | "A description for your prompt.": "A description for your prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}", 11 | "Save": "Save" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/ko/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "다크 모드", 3 | "Light mode": "라이트 모드" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/ko/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "새 폴더", 3 | "New chat": "새 채팅", 4 | "No conversations.": "대화가 없습니다.", 5 | "Search conversations...": "대화 검색...", 6 | "OpenAI API Key": "OpenAI API 키", 7 | "Import data": "대화 가져오기", 8 | "Are you sure?": "확실합니까?", 9 | "Clear conversations": "대화 지우기", 10 | "Export data": "대화 내보내기" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/pl/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "Klucz do OpenAI API jest wymagany", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Proszę wprowadzić swój klucz do OpenAI API na pasku bocznym w lewym dolnym rogu", 4 | "Stop Generating": "Zatrzymaj generowanie", 5 | "Prompt limit is {{maxLength}} characters": "Limit prompta wynosi {{maxLength}} znaków", 6 | "System Prompt": "Prompt systemowy", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Jesteś ChatGPT, duży model językowy wytrenowany przez OpenAI. Postępuj zgodnie z instrukcjami użytkownika. Odpowiedz za pomocą formatu markdown.", 8 | "Enter a prompt": "Wprowadź prompt", 9 | "Regenerate response": "Wygeneruj odpowiedź", 10 | "Sorry, there was an error.": "Przepraszam, wystąpił błąd.", 11 | "Model": "Model", 12 | "Conversation": "Rozmowa", 13 | "OR": "LUB", 14 | "Loading...": "Ładowanie...", 15 | "Type a message...": "Napisz wiadomość...", 16 | "Error fetching models.": "Błąd podczas pobierania modelu", 17 | "AI": "SI", 18 | "You": "Ty", 19 | "Cancel": "Anuluj", 20 | "Save & Submit": "Zapisz i wyślij", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Upewnij się, że wprowadziłeś swój klucz do OpenAI API na pasku bocznym w lewym dolnym rogu", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Jeśli wykonałeś ten krok to oznacza, że mogą występować problemy po stronie OpenAI.", 23 | "click if using a .env.local file": "kliknij jeśli używasz pliku .env.local", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "Limit wiadomości wynosi {{maxLength}} znaków. Wprowadziłeś {{valueLength}} znaków.", 25 | "Please enter a message": "Proszę wpisać swoją wiadomość", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI to zaawansowane narzędzie chatbotów dla modeli czatów od OpenAI, którego celem jest naśladowanie interfejsu i funkcjonalności ChatGPT.", 27 | "Are you sure you want to clear all messages?": "Czy na pewno chcesz usunąć wszystkie wiadomości?" 28 | } 29 | -------------------------------------------------------------------------------- /src/web/public/locales/pl/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/pl/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Skopiuj kod", 3 | "Copied!": "Skopiowany", 4 | "Enter file name": "Wprowadź nazwę pliku" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/pl/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "Nowy prompt", 3 | "New folder": "Nowy folder", 4 | "No prompts.": "Brak promptów.", 5 | "Search prompts...": "Szukaj promptów...", 6 | "Name": "Nazwa", 7 | "Description": "Opis", 8 | "A description for your prompt.": "Opis Twojego prompta.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Zawartość prompta. Użyj {{}} żeby oznaczyć zmienną. Np.: {{nazwa}} jest {{przymiotnik}} {{rzeczownik}}", 11 | "Save": "Zapisz" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/pl/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Tryb ciemny", 3 | "Light mode": "Tryb jasny" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/pl/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Nowy folder", 3 | "New chat": "Nowy chat", 4 | "No conversations.": "Brak rozmów.", 5 | "Search conversations...": "Szukaj rozmów...", 6 | "OpenAI API Key": "Klucz do OpenAI API", 7 | "Import data": "Import rozmów", 8 | "Are you sure?": "Czy jesteś pewien?", 9 | "Clear conversations": "Usuń rozmowy", 10 | "Export data": "Eksport rozmów" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/pt/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "A API Key da OpenAI é necessária", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Por favor, insira sua API Key da OpenAI no canto inferior esquerdo da barra lateral.", 4 | "Stop Generating": "Parar de gerar", 5 | "Prompt limit is {{maxLength}} characters": "O limite da mensagem é de {{maxLength}} caracteres", 6 | "System Prompt": "Mensagem do sistema", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Você é o ChatGPT, um grande modelo de linguagem treinado pela OpenAI. Siga as instruções do usuário cuidadosamente. Responda usando markdown.", 8 | "Enter a prompt": "Insira uma mensagem", 9 | "Regenerate response": "Gerar resposta novamente", 10 | "Sorry, there was an error.": "Desculpe, ocorreu um erro.", 11 | "Model": "Modelo", 12 | "Conversation": "Conversação", 13 | "OR": "Ou", 14 | "Loading...": "Carregando...", 15 | "Type a message...": "Escreva uma mensagem...", 16 | "Error fetching models.": "Erro ao buscar os modelos.", 17 | "AI": "IA", 18 | "You": "Você", 19 | "Cancel": "Cancel", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Certifique-se de que sua API Key da OpenAI esteja definida na parte inferior esquerda da barra lateral.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Se você concluiu esta etapa, o OpenAI pode estar com problemas.", 23 | "click if using a .env.local file": "clique se estiver usando um arquivo .env.local", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "O limite de mensagens é de {{maxLength}} caracteres. Você inseriu {{valueLength}} caracteres", 25 | "Please enter a message": "Por favor, insira uma mensagem", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI é um kit de chatbot avançado para os modelos de chat do OpenAI com o objetivo de imitar a interface e a funcionalidade do ChatGPT.", 27 | "Are you sure you want to clear all messages?": "Tem certeza de que deseja limpar todas as mensagens?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "Valores mais altos como 0,8 tornarão a saída mais aleatória, enquanto valores mais baixos como 0,2 a tornarão mais focada e determinística." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/pt/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/pt/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Copiar código", 3 | "Copied!": "Copiado!", 4 | "Enter file name": "Insira o nome do arquivo" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/pt/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "New prompt", 3 | "New folder": "New folder", 4 | "No prompts.": "No prompts.", 5 | "Search prompts...": "Search prompts...", 6 | "Name": "Name", 7 | "Description": "Description", 8 | "A description for your prompt.": "A description for your prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}", 11 | "Save": "Save" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/pt/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Modo escuro", 3 | "Light mode": "Modo claro" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/pt/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Nova pasta", 3 | "New chat": "Novo chat", 4 | "No conversations.": "Não há conversas.", 5 | "Search conversations...": "Buscar conversas...", 6 | "OpenAI API Key": "API Key da OpenAI", 7 | "Import data": "Importar conversas", 8 | "Are you sure?": "Tem certeza?", 9 | "Clear conversations": "Apagar conversas", 10 | "Export data": "Exportar conversas" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/ro/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "Este necesară cheia API OpenAI", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Introduceți cheia API OpenAI în partea stângă jos a barei laterale", 4 | "Stop Generating": "Nu mai generați", 5 | "Prompt limit is {{maxLength}} characters": "Limita mesajelor este de {{maxLength}} caractere", 6 | "System Prompt": "Solicitări de sistem", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Sunteți ChatGPT, un model de limbă mare antrenat de OpenAI. Urmați cu atenție instrucțiunile de utilizare. Vă rugăm să răspundeți folosind markdown.", 8 | "Enter a prompt": "Introdu o cerere", 9 | "Regenerate response": "Regenerați răspunsul", 10 | "Sorry, there was an error.": "Scuze, a aparut o eroare.", 11 | "Model": "Model", 12 | "Conversation": "Conversaţie", 13 | "OR": "SAU", 14 | "Loading...": "Se încarcă...", 15 | "Type a message...": "Scrie un mesaj...", 16 | "Error fetching models.": "A apărut o eroare la preluarea șabloanelor.", 17 | "AI": "IA", 18 | "You": "Tu", 19 | "Cancel": "Anulare", 20 | "Save & Submit": "Salvați și trimiteți", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Asigurați-vă că cheia dvs. API OpenAI este introdusă în partea stângă jos a barei laterale", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Dacă ați parcurs acest pas, OpenAI poate întâmpina probleme.", 23 | "click if using a .env.local file": "Faceți clic dacă utilizați un fișier .env.local", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "Limita mesajelor este de {{maxLength}} caractere. Ați introdus {{valueLength}} caractere.", 25 | "Please enter a message": "Vă rugăm să scrieți un mesaj", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI este un kit de chatbot avansat pentru șabloanele de chat OpenAI, care își propune să imite interfața și funcționalitatea ChatGPT.", 27 | "Are you sure you want to clear all messages?": "Sigur doriți să ștergeți toate mesajele?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "Valori mai mari, cum ar fi 0,8, vor face ieșirea mai aleatorie, în timp ce valori mai mici, cum ar fi 0,2, o vor face mai concentrată și deterministă." 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/web/public/locales/ro/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/ro/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Copiați codul", 3 | "Copied!": "Copiat!", 4 | "Enter file name": "Introduceți numele fișierului" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/ro/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "Noua solicitare", 3 | "New folder": "Dosar nou", 4 | "No prompts.": "Fără solicitări.", 5 | "Search prompts...": "Cereri de căutare...", 6 | "Name": "Nume", 7 | "Description": "Descriere", 8 | "A description for your prompt.": "Descrierea solicitării prompt.", 9 | "Prompt": "Îndemnuri", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Conținut prompt. Utilizați {{}} pentru a indica o variabilă. De exemplu: {{nume}} este un {{adjectiv}} {{substantiv}}", 11 | "Save": "Salvați" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/ro/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Modul întunecat", 3 | "Light mode": "Modul de golire" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/ro/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Folder nou", 3 | "New chat": "Conversație nouă", 4 | "No conversations.": "Nicio conversație.", 5 | "Search conversations...": "Căutați conversații...", 6 | "OpenAI API Key": "Cheia API OpenAI", 7 | "Import data": "Importați conversații", 8 | "Are you sure?": "Esti sigur?", 9 | "Clear conversations": "Ștergeți conversațiile", 10 | "Export data": "Exportați conversații" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/ru/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "Необходим ключ OpenAI", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Пожалуйста введите API-ключ OpenAI в левом нижнем углу", 4 | "Stop Generating": "Прекратить", 5 | "Prompt limit is {{maxLength}} characters": "Лимит сообщения на символы: {{maxLength}} символов", 6 | "System Prompt": "Системное сообщение", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Вы ChatGPT, большая языковая модель, созданная компанией OpenAI. Следуйте инструкциям пользователя. Отвечайте на сообщения, используя Markdown", 8 | "Enter a prompt": "Введите сообщение", 9 | "Regenerate response": "Перегенерировать сообщение", 10 | "Sorry, there was an error.": "Просим прощения, произошла ошибка", 11 | "Model": "Модель", 12 | "Conversation": "Чат", 13 | "OR": "ИЛИ", 14 | "Loading...": "Пожалуйста подождите...", 15 | "Type a message...": "Введите сообщение...", 16 | "Error fetching models.": "Ошибка при получении списка моделей", 17 | "AI": "Бот", 18 | "You": "Вы", 19 | "Cancel": "Отмена", 20 | "Save & Submit": "Отредактировать", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Убедитесь, что вы ввели API-ключ OpenAI.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Если вы выполнили этот шаг, то возможно OpenAI может испытывать проблемы", 23 | "click if using a .env.local file": "click if using a .env.local file", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "Лимит сообщения: {{maxLength}} символов. Вы ввели {{valueLength}} символов.", 25 | "Please enter a message": "Пожалуйста введите сообщение", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI - продвинутый интерфейс чатбота для чат-моделей OpenAI, имитирующий интерфейс ChatGPT", 27 | "Are you sure you want to clear all messages?": "Вы уверены, что хотите удалить все сообщения?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "Более высокие значения, такие как 0,8, сделают вывод более случайным, в то время как более низкие значения, например, 0,2, сделают его более фокусированным и детерминированным." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/ru/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/ru/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Скопировать", 3 | "Copied!": "Скопировано!", 4 | "Enter file name": "Введите имя файла для загрузки" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/ru/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "New prompt", 3 | "New folder": "New folder", 4 | "No prompts.": "No prompts.", 5 | "Search prompts...": "Search prompts...", 6 | "Name": "Name", 7 | "Description": "Description", 8 | "A description for your prompt.": "A description for your prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}", 11 | "Save": "Save" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/ru/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Темный режим", 3 | "Light mode": "Светлый режим" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/ru/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Новая папка", 3 | "New chat": "Новый чат", 4 | "No conversations.": "Нет чатов.", 5 | "Search conversations...": "Поиск чатов...", 6 | "OpenAI API Key": "API-ключ OpenAI", 7 | "Import data": "Импортировать чаты", 8 | "Are you sure?": "Вы уверены?", 9 | "Clear conversations": "Удалить чаты", 10 | "Export data": "Экспортировать чаты" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/si/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "OpenAI API යතුර අවශ්‍යයි", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "කරුණාකර ඔබේ OpenAI API යතුර පැති තීරුවේ පහළ වම්පසින් සකසන්න.", 4 | "Stop Generating": "උත්පාදනය නවත්වන්න", 5 | "Prompt limit is {{maxLength}} characters": "වචන සීමාව අනුලකුණු {{maxLength}} කි", 6 | "System Prompt": "පද්ධති ඉඟිය", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "ඔබ ChatGPT, OpenAI විසින් පුහුණු කරන ලද විශාල භාෂා ආකෘතියකි. පරිශීලක උපදෙස් ප්රවේශමෙන් අනුගමනය කරන්න. මාර්ක්ඩවුන් භාවිතයෙන් ප්‍රතිචාර දක්වන්න.", 8 | "Enter a prompt": "ප්‍රේරකයක් ඇතුළු කරන්න", 9 | "Regenerate response": "ප්‍රතිචාරය පුනර්ජනනය කරන්න", 10 | "Sorry, there was an error.": "සමාවන්න, දෝෂයක් ඇති විය.", 11 | "Model": "ආකෘතිය", 12 | "Conversation": "සංවාදය", 13 | "OR": "හෝ", 14 | "Loading...": "පූරණය වෙමින්...", 15 | "Type a message...": "පණිවිඩයක් ටයිප් කරන්න...", 16 | "Error fetching models.": "ආකෘති ලබා ගැනීමේ දෝෂයකි.", 17 | "AI": "AI", 18 | "You": "ඔබ", 19 | "Cancel": "Cancel", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "ඔබේ OpenAI API යතුර පැති තීරුවේ පහළ වම්පස සකසා ඇති බවට වග බලා ගන්න.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "ඔබ මෙම පියවර සම්පූර්ණ කළේ නම්, OpenAI හි ගැටලුවක් විය හැකිය.", 23 | "click if using a .env.local file": "click if using a .env.local file", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "පණිවිඩ සීමාව අකුරු {{maxLength}} කි. ඔබ අක්ෂර {{valueLength}} ඇතුළත් කර ඇත.।", 25 | "Please enter a message": "කරුණාකර පණිවිඩයක් ඇතුළු කරන්න", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI යනු ChatGPT හි අතුරු මුහුණත සහ ක්‍රියාකාරීත්වය අනුකරණය කිරීම අරමුණු කරගත් OpenAI හි චැට් මාදිලි සඳහා වන උසස් චැට්බෝට් කට්ටලයකි.", 27 | "Are you sure you want to clear all messages?": "ඔබට සියලු පණිවිඩ හිස් කිරීමට අවශ්‍ය බව විශ්වාසද?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "0.8 ආකෘතිය ඉහළට පිරිමිතුරු වර්ණයෙන් තිබේ විය යුතුය, නමුත් 0.2 ආකෘතිය අවම වශයෙන් එය විශේෂිත හා නිර්ණායක වනු ඇත." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/si/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/si/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "කේතය පිටපත් කරන්න", 3 | "Copied!": "පිටපත් කළා!", 4 | "Enter file name": "ගොනු නාමය ඇතුළත් කරන්න" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/si/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "New prompt", 3 | "New folder": "New folder", 4 | "No prompts.": "No prompts.", 5 | "Search prompts...": "Search prompts...", 6 | "Name": "Name", 7 | "Description": "Description", 8 | "A description for your prompt.": "A description for your prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}", 11 | "Save": "Save" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/si/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "අඳුරු මාදිලිය", 3 | "Light mode": "ආලෝක මාදිලිය" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/si/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "නව ෆෝල්ඩරය", 3 | "New chat": "නව සංවාදයක්", 4 | "No conversations.": "සංවාද නැත.", 5 | "Search conversations...": "සංවාද සොයන්න...", 6 | "OpenAI API Key": "OpenAI API යතුර", 7 | "Import data": "සංවාද ආයාත කරන්න", 8 | "Are you sure?": "ඔබට විශ්වාස ද?", 9 | "Clear conversations": "සංවාද මකන්න", 10 | "Export data": "සංවාද නිර්යාත කරන්න" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/sv/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "OpenAI API-nyckel krävs", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Vänligen ange din OpenAI API-nyckel längst ner till vänster i sidofältet.", 4 | "Stop Generating": "Sluta generera", 5 | "Prompt limit is {{maxLength}} characters": "Din prompt kan inte ha fler än {{maxLength}} tecken", 6 | "System Prompt": "System prompt", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Du är ChatGPT, en stor språkmodell tränad av OpenAI. Följ användarens instruktioner noggrant. Svara genom att använda markdown.", 8 | "Enter a prompt": "Ange en prompt", 9 | "Regenerate response": "Återskapa svar", 10 | "Sorry, there was an error.": "Ursäkta, det uppstod ett fel.", 11 | "Model": "Modell", 12 | "Conversation": "Konversation", 13 | "OR": "ELLER", 14 | "Loading...": "Laddar...", 15 | "Type a message...": "Skriv ett meddelande...", 16 | "Error fetching models.": "Det gick inte att hämta modeller.", 17 | "AI": "AI", 18 | "You": "Du", 19 | "Cancel": "Avbryt", 20 | "Save & Submit": "Spara & Skicka", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Se till att du har angett din OpenAI API-nyckel längst ner till vänster i sidofältet.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Om du slutförde det här steget kan OpenAI ha problem.", 23 | "click if using a .env.local file": "klicka om du använder en .env.local-fil", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "Meddelandegränsen är {{maxLength}} tecken. Du har angett {{valueLength}} tecken.", 25 | "Please enter a message": "Vänligen ange ett meddelande", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI är ett avancerat chatbot-kit för OpenAI:s chattmodeller som syftar till att efterlikna ChatGPT:s gränssnitt och funktionalitet.", 27 | "Are you sure you want to clear all messages?": "Är du säker på att du vill rensa alla meddelanden?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "Högre värden som 0,8 kommer att göra utdata mer slumpmässig, medan lägre värden som 0,2 kommer att göra den mer fokuserad och deterministisk." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/sv/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/sv/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Kopiera kod", 3 | "Copied!": "Kopierad!", 4 | "Enter file name": "Ange filnamn" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/sv/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "Ny prompt", 3 | "New folder": "Ny mapp", 4 | "No prompts.": "Inga prompts.", 5 | "Search prompts...": "Sök prompts...", 6 | "Name": "Namn", 7 | "Description": "Beskrivning", 8 | "A description for your prompt.": "En beskrivning för din prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt-innehåll. Använd {{}} för att beteckna en variabel. Ex: {{namn}} är ett {{adjektiv}} {{substantiv}}", 11 | "Save": "Spara" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/sv/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Mörkt läge", 3 | "Light mode": "Ljust läge" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/sv/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Ny mapp", 3 | "New chat": "Ny chatt", 4 | "No conversations.": "Inga konversationer.", 5 | "Search conversations...": "Sök konversationer...", 6 | "OpenAI API Key": "OpenAI API-nyckel", 7 | "Import data": "Importera konversationer", 8 | "Are you sure?": "Är du säker?", 9 | "Clear conversations": "Radera konversationer", 10 | "Export data": "Exportera konversationer" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/te/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "ఒపెన్ ఎయి ఐ API కీ అవసరం", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "దయచేసి మీ OpenAI API కీని సైడ్ బార్ యొక్క దిగువ ఎడమ భాగంలో సెట్ చేయండి.", 4 | "Stop Generating": "జెనరేట్ చేస్తున్న ప్రక్రియ నిలిపేయి", 5 | "Prompt limit is {{maxLength}} characters": "ప్రాంప్ట్(సంకేతం) పరిమితి {{maxLength}} అక్షరాలు మాత్రమే", 6 | "System Prompt": "సిస్టమ్ ప్రాంప్ట్", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "మీరు ChatGPT, ఒక పెద్ద భాషా మోడల్ ఓపెన్‌ఏఐ ద్వారా ట్రైన్ చేయబడింది. యూజర్ ఇన్స్ట్రక్షన్స్ కనుగొనండి. మార్క్‌డౌన్ ఉపయోగించి సమాధానం ఇవ్వండి.", 8 | "Enter a prompt": "ఒక ప్రాంప్ట్(సంకేతం) నమోదు చేయండి", 9 | "Regenerate response": "పునరుత్పాదించు సమాధానం", 10 | "Sorry, there was an error.": "క్షమించండి, ఒక పొరపాటు జరిగింది.", 11 | "Model": "మోడల్", 12 | "Conversation": "సంవాదం", 13 | "OR": "లేదా", 14 | "Loading...": "లోడ్ అవుతోంది...", 15 | "Type a message...": "సందేశం టైప్ చేయండి...", 16 | "Error fetching models.": "మోడల్స్ పొందడం లోపం జరిగింది.", 17 | "AI": "AI", 18 | "You": "నీవు", 19 | "Cancel": "Cancel", 20 | "Save & Submit": "Save & Submit", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "మీరు ఖాళీలో ఎడమ ఎరుగులో మీ OpenAI API కీను సెట్ చేస్తున్నారని ఖచ్చితం చేయండి.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "మీరు ఈ హంతం పూర్తి చేసినా, OpenAI సమస్యలు ఉన్నట్లు ఉంటాయి.", 23 | "click if using a .env.local file": "click if using a .env.local file", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "సందేశం పరిమితి {{maxLength}} అక్షరాలు. మీరు {{valueLength}} అక్షరాలు నమోదు చేసారు.", 25 | "Please enter a message": "దయచేసి ఒక సందేశం నమోదు చేయండి", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI ఒక అభ్యంతర సంవిధానం మరియు కార్యాచరణ లక్ష్యం తీసుకున్న OpenAI ఛాట్ మోడల్లలో మార్పులు చేయడానికి ప్రయత్నిస్తుంది, ChatGPT ఇంటర్ఫేస్ మరియు కార్యాచరణను అనుకరించడానికి.", 27 | "Are you sure you want to clear all messages?": "మీరు అన్ని సందేశాలను తొలగించాలా?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "0.8 పైకి ఉన్న పెరిగిన విలువలు ఎక్కువగా విస్తరించినట్లుగా ఉంటాయి, మరియు 0.2 పైకి ఉన్న తక్కువ విలువలు కేంద్రీకృతం మరియు నిర్ణయాత్మకంగా మార్చవచ్చు." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/te/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/te/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "కోడ్‌ను కాపీ చేయండి", 3 | "Copied!": "కాపీ చేయబడింది!", 4 | "Enter file name": "ఫైల్ పేరు నమోదు చేయండి" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/te/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "New prompt", 3 | "New folder": "New folder", 4 | "No prompts.": "No prompts.", 5 | "Search prompts...": "Search prompts...", 6 | "Name": "Name", 7 | "Description": "Description", 8 | "A description for your prompt.": "A description for your prompt.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}", 11 | "Save": "Save" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/te/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "డార్క్ మోడ్", 3 | "Light mode": "లైట్ మోడ్" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/te/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "కొత్త ఫోల్డర్", 3 | "New chat": "కొత్త చాట్", 4 | "No conversations.": "సంభాషణలు లేవు.", 5 | "Search conversations...": "సంభాషణలు వెతకండి...", 6 | "OpenAI API Key": "ఒపెన్ ఎయి ఐ API కీ ", 7 | "Import data": "సంభాషణలు దిగుమతి చేయండి", 8 | "Are you sure?": "మీరు ఖచ్చితంగా ఉన్నారా?", 9 | "Clear conversations": "సంభాషణలు తొలగించు", 10 | "Export data": "సంభాషణలు ఎగుమతి చేయండి" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/tr/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "OpenAI API Anahtarı Gerekli", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Lütfen OpenAI API anahtarınızı yan çubuğun sol altınan'dan ayarlayın.", 4 | "Stop Generating": "Durdur", 5 | "Prompt limit is {{maxLength}} characters": "Prompt sınırı {{maxLength}} karakterdir", 6 | "System Prompt": "Sistem Prompt", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Sen ChatGPT'sin, OpenAI tarafından eğitilmiş büyük bir dil modelisin. Kullanıcının talimatlarını dikkatlice takip et. Yanıtını markdown kullanarak ver.", 8 | "Enter a prompt": "Bir prompt girin", 9 | "Regenerate response": "Yanıtı Yeniden Oluştur", 10 | "Sorry, there was an error.": "Üzgünüm, bir hata oluştu.", 11 | "Model": "Model", 12 | "Conversation": "Sohbet", 13 | "OR": "VEYA", 14 | "Loading...": "Yükleniyor...", 15 | "Type a message...": "Bir mesaj yazın...", 16 | "Error fetching models.": "Modeller getirilirken hata oluştu.", 17 | "AI": "Yapay Zeka", 18 | "You": "Sen", 19 | "Cancel": "İptal", 20 | "Save & Submit": "Kaydet ve Gönder", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "OpenAI API anahtarınızın yan çubuğun sol altında ayarlandığından emin ol.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Bu adımı tamamladıysanız, OpenAI sorun yaşıyor olabilir.", 23 | "click if using a .env.local file": "Eğer .env.local dosyası kullanıyorsanız tıklayın", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "Mesaj sınırı {{maxLength}} karakterdir. {{valueLength}} karakter girdiniz.", 25 | "Please enter a message": "Lütfen bir mesaj girin", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI, ChatGPT'nin arayüz ve işlevselliğini taklit etmeyi amaçlayan OpenAI'in sohbet modelleri için gelişmiş bir sohbetbot kitidir.", 27 | "Are you sure you want to clear all messages?": "Tüm mesajları temizlemek istediğinize emin misiniz?" 28 | } 29 | -------------------------------------------------------------------------------- /src/web/public/locales/tr/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/tr/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Kodu kopyala", 3 | "Copied!": "Kopyalandi!", 4 | "Enter file name": "Dosya ismi gir" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/tr/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "Yeni prompt", 3 | "New folder": "Yeni klasör", 4 | "No prompts.": "Prompt yok.", 5 | "Search prompts...": "Prompt'ları ara...", 6 | "Name": "İsim", 7 | "Description": "Açıklama", 8 | "A description for your prompt.": "Prompt'unuz için bir açıklama.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Prompt içeriği. Değişken belirtmek için {{}} kullanın. Örn: {{ad}} bir {{sıfat}} {{isim}}", 11 | "Save": "Kaydet" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/tr/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Yeni klasör", 3 | "New chat": "Yeni sohbet", 4 | "No conversations.": "Hiçbir konuşma yok.", 5 | "Search conversations...": "Sohbetleri ara...", 6 | "OpenAI API Key": "OpenAI API Anahtarı", 7 | "Import data": "Veri içe aktar", 8 | "Are you sure?": "Emin misiniz?", 9 | "Clear conversations": "Konuşmaları temizle", 10 | "Export data": "Veri dışa aktar", 11 | "Dark mode": "Karanlık mod", 12 | "Light mode": "Aydınlık mod", 13 | "Plugin Keys": "Plugin Anahtarları" 14 | } 15 | -------------------------------------------------------------------------------- /src/web/public/locales/vi/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "Yêu cầu nhập API Key từ tài khoản OpenAI", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "Vui lòng nhập API Key từ tài khoản OpenAI của bạn vào ô dưới cùng của thanh bên trái.", 4 | "Stop Generating": "Dừng tạo", 5 | "Prompt limit is {{maxLength}} characters": "Giới hạn Prompt là {{maxLength}} ký tự", 6 | "System Prompt": "Prompt hệ thống", 7 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "Bạn là ChatGPT, một mô hình ngôn ngữ lớn được đào tạo bởi OpenAI. Hãy tuân theo hướng dẫn của người dùng một cách cẩn thận. Phản hồi bằng cách sử dụng định dạng markdown.", 8 | "Enter a prompt": "Nhập một Prompt", 9 | "Regenerate response": "Tạo lại phản hồi", 10 | "Sorry, there was an error.": "Xin lỗi, đã xảy ra lỗi.", 11 | "Model": "Mô hình", 12 | "Conversation": "Cuộc trò chuyện", 13 | "OR": "HOẶC", 14 | "Loading...": "Đang tải...", 15 | "Type a message...": "Nhập một tin nhắn...", 16 | "Error fetching models.": "Lỗi khi truy xuất mô hình.", 17 | "AI": "AI", 18 | "You": "Bạn", 19 | "Cancel": "Hủy", 20 | "Save & Submit": "Lưu & Gửi", 21 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "Hãy đảm bảo rằng khóa API từ tài khoản OpenAI của bạn đã được nhập vào ô dưới cùng của thanh bên trái.", 22 | "If you completed this step, OpenAI may be experiencing issues.": "Nếu bạn đã hoàn thành bước này, OpenAI có thể đang gặp sự cố.", 23 | "click if using a .env.local file": "Bấm vào đây nếu dùng tệp .env.local", 24 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "Giới hạn tin nhắn là {{maxLength}} ký tự. Bạn đã nhập {{valueLength}} ký tự.", 25 | "Please enter a message": "Vui lòng nhập một tin nhắn", 26 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI là một bộ công cụ chatbot tiên tiến cho các mô hình chat của OpenAI nhằm mô phỏng giao diện và chức năng của ChatGPT.", 27 | "Are you sure you want to clear all messages?": "Bạn có chắc chắn muốn xóa tất cả tin nhắn không?", 28 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "Các giá trị cao hơn như 0,8 sẽ làm cho đầu ra ngẫu nhiên hơn, trong khi các giá trị thấp hơn như 0,2 sẽ làm cho đầu ra tập trung và xác định hơn." 29 | } 30 | -------------------------------------------------------------------------------- /src/web/public/locales/vi/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/vi/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "Sao chép mã", 3 | "Copied!": "Đã sao chép!", 4 | "Enter file name": "Nhập tên file" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/vi/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "Prompt mới", 3 | "New folder": "Thư mục mới", 4 | "No prompts.": "Không có Prompt nào.", 5 | "Search prompts...": "Tìm kiếm các Prompt...", 6 | "Name": "Tên", 7 | "Description": "Mô tả", 8 | "A description for your prompt.": "Một mô tả cho Prompt của bạn.", 9 | "Prompt": "Prompt", 10 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "Nội dung Prompt. Sử dụng {{}} để biểu thị một biến. Ví dụ: {{name}} là một {{adjective}} {{noun}}", 11 | "Save": "Lưu" 12 | } 13 | -------------------------------------------------------------------------------- /src/web/public/locales/vi/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dark mode": "Chế độ tối", 3 | "Light mode": "Chế độ sáng" 4 | } 5 | -------------------------------------------------------------------------------- /src/web/public/locales/vi/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "Thư mục mới", 3 | "New chat": "Tạo hội thoại mới", 4 | "No conversations.": "Không có hội thoại nào.", 5 | "Search conversations...": "Tìm kiếm các cuộc hội thoại...", 6 | "OpenAI API Key": "OpenAI API Key", 7 | "Import data": "Nhập dữ liệu hội thoại", 8 | "Are you sure?": "Bạn chắc chắn chứ?", 9 | "Clear conversations": "Xoá các đoạn hội thoại", 10 | "Export data": "Xuất dữ liệu hội thoại" 11 | } 12 | -------------------------------------------------------------------------------- /src/web/public/locales/zh/chat.json: -------------------------------------------------------------------------------- 1 | { 2 | "OpenAI API Key Required": "需要 OpenAI API 密钥", 3 | "Please set your OpenAI API key in the bottom left of the sidebar.": "请在侧边栏左下角设置您的 OpenAI API 密钥。", 4 | "If you don't have an OpenAI API key, you can get one here: ": "如果你没有 OpenAI API 密钥,你可以在此获取:", 5 | "Stop Generating": "停止生成", 6 | "Prompt limit is {{maxLength}} characters": "提示字数限制为 {{maxLength}} 个字符", 7 | "New Conversation": "新的聊天", 8 | "System Prompt": "系统提示", 9 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.": "你是 ChatGPT,一个由 OpenAI 训练的大型语言模型。请仔细遵循用户的指示。使用 Markdown 格式进行回应。", 10 | "Enter a prompt": "输入一个提示", 11 | "Regenerate response": "重新生成回应", 12 | "Sorry, there was an error.": "抱歉,出现了错误。", 13 | "Model": "模型", 14 | "Conversation": "对话", 15 | "OR": "或", 16 | "Loading...": "加载中...", 17 | "Type a message or type \"/\" to select a prompt...": "输入一条消息或键入 \"/\" 以选择提示...", 18 | "Error fetching models.": "获取模型时出错。", 19 | "AI": "AI", 20 | "You": "你", 21 | "Cancel": "取消", 22 | "Save & Submit": "保存并提交", 23 | "Make sure your OpenAI API key is set in the bottom left of the sidebar.": "请确保您的 OpenAI API 密钥已在侧边栏左下角设置。", 24 | "If you completed this step, OpenAI may be experiencing issues.": "如果您已完成此步骤,OpenAI 可能遇到了问题。", 25 | "click if using a .env.local file": "click if using a .env.local file", 26 | "Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "消息字数限制为 {{maxLength}} 个字符。您已输入 {{valueLength}} 个字符。", 27 | "Please enter a message": "请输入一条消息", 28 | "Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI 是一个高级聊天机器人工具包,旨在模仿 OpenAI 聊天模型的 ChatGPT 界面和功能。", 29 | "Are you sure you want to clear all messages?": "你确定要清除所有的消息吗?", 30 | "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.": "较高的数值(例如0.8)会使输出更随机,而较低的数值(例如0.2)会使输出更加聚焦和确定性更强。", 31 | "View Account Usage": "查阅账户用量", 32 | "Temperature": "生成温度", 33 | "Precise": "保守", 34 | "Neutral": "中立", 35 | "Creative": "随性" 36 | } 37 | -------------------------------------------------------------------------------- /src/web/public/locales/zh/common.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/web/public/locales/zh/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "Copy code": "复制代码", 3 | "Copied!": "已复制!", 4 | "Enter file name": "输入文件名" 5 | } 6 | -------------------------------------------------------------------------------- /src/web/public/locales/zh/promptbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New prompt": "新建提示", 3 | "New folder": "新建文件夹", 4 | "No prompts.": "无提示词", 5 | "Search prompts...": "搜索提示...", 6 | "Name": "名称", 7 | "A name for your prompt.": "提示词名称", 8 | "Description": "描述", 9 | "A description for your prompt.": "提示词描述", 10 | "Prompt": "提示词", 11 | "Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "提示内容。使用 {{}} 表示一个变量。例如:{{name}} 是一个 {{adjective}} {{noun}}", 12 | "Save": "保存" 13 | } 14 | -------------------------------------------------------------------------------- /src/web/public/locales/zh/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Settings": "设置", 3 | "Theme": "主题", 4 | "Dark mode": "深色模式", 5 | "Light mode": "浅色模式", 6 | "Save": "保存" 7 | } 8 | -------------------------------------------------------------------------------- /src/web/public/locales/zh/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "New folder": "新建文件夹", 3 | "New chat": "新建聊天", 4 | "New Conversation": "新的聊天", 5 | "No conversations.": "无对话", 6 | "Search conversations...": "搜索对话...", 7 | "OpenAI API Key": "OpenAI API 密钥", 8 | "Import data": "导入对话", 9 | "Are you sure?": "确定吗?", 10 | "Clear conversations": "清空对话", 11 | "Settings": "设置", 12 | "Export data": "导出对话", 13 | "Plugin Keys": "插件密钥" 14 | } 15 | -------------------------------------------------------------------------------- /src/web/public/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/src/web/public/screenshot.png -------------------------------------------------------------------------------- /src/web/public/screenshots/screenshot-0402023.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/empower-ai/sql-agent/1e7a49721d1322b6691fad761247df475c65baba/src/web/public/screenshots/screenshot-0402023.jpg -------------------------------------------------------------------------------- /src/web/services/useApiService.ts: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react'; 2 | 3 | import { useFetch } from '@/hooks/useFetch'; 4 | 5 | export interface GetModelsRequestProps { 6 | key: string 7 | } 8 | 9 | const useApiService = () => { 10 | const fetchService = useFetch(); 11 | 12 | const getModels = useCallback( 13 | async (params: GetModelsRequestProps, signal?: AbortSignal) => { 14 | return await fetchService.post('/api/models', { 15 | body: { key: params.key }, 16 | headers: { 17 | 'Content-Type': 'application/json' 18 | }, 19 | signal 20 | }); 21 | }, 22 | [fetchService] 23 | ); 24 | 25 | return { 26 | getModels 27 | }; 28 | }; 29 | 30 | export default useApiService; 31 | -------------------------------------------------------------------------------- /src/web/styles/Home.module.css: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 0 2rem; 3 | } 4 | 5 | .main { 6 | min-height: 100vh; 7 | padding: 4rem 0; 8 | flex: 1; 9 | display: flex; 10 | flex-direction: column; 11 | justify-content: center; 12 | align-items: center; 13 | } 14 | 15 | .footer { 16 | display: flex; 17 | flex: 1; 18 | padding: 2rem 0; 19 | border-top: 1px solid #eaeaea; 20 | justify-content: center; 21 | align-items: center; 22 | } 23 | 24 | .footer a { 25 | display: flex; 26 | justify-content: center; 27 | align-items: center; 28 | flex-grow: 1; 29 | } 30 | 31 | .title a { 32 | color: #0070f3; 33 | text-decoration: none; 34 | } 35 | 36 | .title a:hover, 37 | .title a:focus, 38 | .title a:active { 39 | text-decoration: underline; 40 | } 41 | 42 | .title { 43 | margin: 0; 44 | line-height: 1.15; 45 | font-size: 4rem; 46 | } 47 | 48 | .title, 49 | .description { 50 | text-align: center; 51 | } 52 | 53 | .description { 54 | margin: 4rem 0; 55 | line-height: 1.5; 56 | font-size: 1.5rem; 57 | } 58 | 59 | .code { 60 | background: #fafafa; 61 | border-radius: 5px; 62 | padding: 0.75rem; 63 | font-size: 1.1rem; 64 | font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, 65 | Bitstream Vera Sans Mono, Courier New, monospace; 66 | } 67 | 68 | .grid { 69 | display: flex; 70 | align-items: center; 71 | justify-content: center; 72 | flex-wrap: wrap; 73 | max-width: 800px; 74 | } 75 | 76 | .card { 77 | margin: 1rem; 78 | padding: 1.5rem; 79 | text-align: left; 80 | color: inherit; 81 | text-decoration: none; 82 | border: 1px solid #eaeaea; 83 | border-radius: 10px; 84 | transition: color 0.15s ease, border-color 0.15s ease; 85 | max-width: 300px; 86 | } 87 | 88 | .card:hover, 89 | .card:focus, 90 | .card:active { 91 | color: #0070f3; 92 | border-color: #0070f3; 93 | } 94 | 95 | .card h2 { 96 | margin: 0 0 1rem 0; 97 | font-size: 1.5rem; 98 | } 99 | 100 | .card p { 101 | margin: 0; 102 | font-size: 1.25rem; 103 | line-height: 1.5; 104 | } 105 | 106 | .logo { 107 | height: 1em; 108 | margin-left: 0.5rem; 109 | } 110 | 111 | @media (max-width: 600px) { 112 | .grid { 113 | width: 100%; 114 | flex-direction: column; 115 | } 116 | } 117 | 118 | @media (prefers-color-scheme: dark) { 119 | .card, 120 | .footer { 121 | border-color: #222; 122 | } 123 | .code { 124 | background: #111; 125 | } 126 | .logo img { 127 | filter: invert(1); 128 | } 129 | } -------------------------------------------------------------------------------- /src/web/styles/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | ::-webkit-scrollbar-track { 6 | background-color: transparent; 7 | } 8 | 9 | ::-webkit-scrollbar-thumb { 10 | background-color: #ccc; 11 | border-radius: 10px; 12 | } 13 | 14 | ::-webkit-scrollbar-thumb:hover { 15 | background-color: #aaa; 16 | } 17 | 18 | ::-webkit-scrollbar-track:hover { 19 | background-color: #f2f2f2; 20 | } 21 | 22 | ::-webkit-scrollbar-corner { 23 | background-color: transparent; 24 | } 25 | 26 | ::-webkit-scrollbar { 27 | width: 6px; 28 | height: 6px; 29 | } 30 | 31 | html { 32 | background: #202123; 33 | } 34 | 35 | @media (max-width: 720px) { 36 | pre { 37 | width: calc(100vw - 110px); 38 | } 39 | } 40 | 41 | pre:has(div.codeblock) { 42 | padding: 0; 43 | } 44 | 45 | .cm-content { 46 | white-space: pre-wrap !important; 47 | word-break: normal !important; 48 | word-wrap: break-word !important; 49 | display: inline-block !important; 50 | width: 100% !important; 51 | } 52 | -------------------------------------------------------------------------------- /src/web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "./**/*", 4 | "../**/*" 5 | ], 6 | "exclude": [ 7 | "node_modules", 8 | "**/.next", 9 | "**/dist" 10 | ], 11 | "extends": "../../tsconfig.json", 12 | "compilerOptions": { 13 | "target": "ES2020", 14 | "lib": [ 15 | "dom", 16 | "dom.iterable", 17 | "esnext" 18 | ], 19 | "allowJs": true, 20 | "allowSyntheticDefaultImports": true, 21 | "module": "commonjs", 22 | "outDir": "../../dist", 23 | "moduleResolution": "node", 24 | "strict": true, 25 | "noEmit": false, 26 | "types": [ 27 | "node" 28 | ], 29 | "esModuleInterop": true, 30 | "skipLibCheck": true, 31 | "jsx": "preserve", 32 | "forceConsistentCasingInFileNames": true, 33 | "incremental": true, 34 | "resolveJsonModule": true, 35 | "isolatedModules": true, 36 | "paths": { 37 | "@/*": [ 38 | "./*" 39 | ] 40 | }, 41 | } 42 | } -------------------------------------------------------------------------------- /src/web/types/chat.ts: -------------------------------------------------------------------------------- 1 | import { type OpenAIModel } from './openai'; 2 | 3 | export interface SenseiResponse { 4 | question: string 5 | query: string 6 | assumption: string 7 | resultData: string 8 | answer: string 9 | hasResult: string 10 | err: string 11 | } 12 | 13 | export interface RunQueryResult { 14 | query: string 15 | hasResult: string 16 | resultData: string 17 | err: string 18 | } 19 | 20 | export interface AssistantMessage { 21 | senseiResponse: SenseiResponse 22 | updatedQuery?: string 23 | updatedAnswer?: string 24 | } 25 | 26 | export interface Message { 27 | role: Role 28 | content: string 29 | } 30 | 31 | export type Role = 'assistant' | 'user'; 32 | 33 | export interface QuestionBody { 34 | question: string 35 | conversationId: string 36 | providedAssumptions: string | null 37 | } 38 | 39 | export interface ChatBody { 40 | model: OpenAIModel 41 | messages: Message[] 42 | key: string 43 | prompt: string 44 | temperature: number 45 | conversationId: string 46 | } 47 | 48 | export interface Conversation { 49 | id: string 50 | name: string 51 | messages: Message[] 52 | model: OpenAIModel 53 | prompt: string 54 | temperature: number 55 | folderId: string | null 56 | } 57 | -------------------------------------------------------------------------------- /src/web/types/data.ts: -------------------------------------------------------------------------------- 1 | export interface KeyValuePair { 2 | key: string 3 | value: any 4 | } 5 | -------------------------------------------------------------------------------- /src/web/types/env.ts: -------------------------------------------------------------------------------- 1 | export interface ProcessEnv { 2 | OPENAI_API_KEY: string 3 | OPENAI_API_HOST?: string 4 | OPENAI_API_TYPE?: 'openai' | 'azure' 5 | OPENAI_API_VERSION?: string 6 | OPENAI_ORGANIZATION?: string 7 | } 8 | -------------------------------------------------------------------------------- /src/web/types/error.ts: -------------------------------------------------------------------------------- 1 | export interface ErrorMessage { 2 | code: string | null 3 | title: string 4 | messageLines: string[] 5 | } 6 | -------------------------------------------------------------------------------- /src/web/types/export.ts: -------------------------------------------------------------------------------- 1 | import { type Conversation, type Message } from './chat'; 2 | import { type FolderInterface } from './folder'; 3 | import { type Prompt } from './prompt'; 4 | 5 | export type SupportedExportFormats = 6 | | ExportFormatV1 7 | | ExportFormatV2 8 | | ExportFormatV3 9 | | ExportFormatV4; 10 | export type LatestExportFormat = ExportFormatV4; 11 | 12 | /// ///////////////////////////////////////////////////////////////////////////////////////// 13 | interface ConversationV1 { 14 | id: number 15 | name: string 16 | messages: Message[] 17 | } 18 | 19 | export type ExportFormatV1 = ConversationV1[]; 20 | 21 | /// ///////////////////////////////////////////////////////////////////////////////////////// 22 | interface ChatFolder { 23 | id: number 24 | name: string 25 | } 26 | 27 | export interface ExportFormatV2 { 28 | history: Conversation[] | null 29 | folders: ChatFolder[] | null 30 | } 31 | 32 | /// ///////////////////////////////////////////////////////////////////////////////////////// 33 | export interface ExportFormatV3 { 34 | version: 3 35 | history: Conversation[] 36 | folders: FolderInterface[] 37 | } 38 | 39 | export interface ExportFormatV4 { 40 | version: 4 41 | history: Conversation[] 42 | folders: FolderInterface[] 43 | prompts: Prompt[] 44 | } 45 | -------------------------------------------------------------------------------- /src/web/types/folder.ts: -------------------------------------------------------------------------------- 1 | export interface FolderInterface { 2 | id: string 3 | name: string 4 | type: FolderType 5 | } 6 | 7 | export type FolderType = 'chat' | 'prompt'; 8 | -------------------------------------------------------------------------------- /src/web/types/google.ts: -------------------------------------------------------------------------------- 1 | import { type ChatBody, type Message } from './chat'; 2 | 3 | export interface GoogleBody extends ChatBody { 4 | googleAPIKey: string 5 | googleCSEId: string 6 | } 7 | 8 | export interface GoogleResponse { 9 | message: Message 10 | } 11 | 12 | export interface GoogleSource { 13 | title: string 14 | link: string 15 | displayLink: string 16 | snippet: string 17 | image: string 18 | text: string 19 | } 20 | -------------------------------------------------------------------------------- /src/web/types/index.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /src/web/types/openai.ts: -------------------------------------------------------------------------------- 1 | export interface OpenAIModel { 2 | id: string 3 | name: string 4 | maxLength: number // maximum length of a message 5 | tokenLimit: number 6 | } 7 | 8 | export enum OpenAIModelID { 9 | GPT_3_5 = 'gpt-3.5-turbo', 10 | GPT_3_5_AZ = 'gpt-35-turbo', 11 | GPT_4 = 'gpt-4', 12 | GPT_4_32K = 'gpt-4-32k', 13 | } 14 | 15 | // in case the `DEFAULT_MODEL` environment variable is not set or set to an unsupported model 16 | export const fallbackModelID = OpenAIModelID.GPT_3_5; 17 | 18 | export const OpenAIModels: Record = { 19 | [OpenAIModelID.GPT_3_5]: { 20 | id: OpenAIModelID.GPT_3_5, 21 | name: 'GPT-3.5', 22 | maxLength: 12000, 23 | tokenLimit: 4000 24 | }, 25 | [OpenAIModelID.GPT_3_5_AZ]: { 26 | id: OpenAIModelID.GPT_3_5_AZ, 27 | name: 'GPT-3.5', 28 | maxLength: 12000, 29 | tokenLimit: 4000 30 | }, 31 | [OpenAIModelID.GPT_4]: { 32 | id: OpenAIModelID.GPT_4, 33 | name: 'GPT-4', 34 | maxLength: 24000, 35 | tokenLimit: 8000 36 | }, 37 | [OpenAIModelID.GPT_4_32K]: { 38 | id: OpenAIModelID.GPT_4_32K, 39 | name: 'GPT-4-32K', 40 | maxLength: 96000, 41 | tokenLimit: 32000 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /src/web/types/plugin.ts: -------------------------------------------------------------------------------- 1 | import { type KeyValuePair } from './data'; 2 | 3 | export interface Plugin { 4 | id: PluginID 5 | name: PluginName 6 | requiredKeys: KeyValuePair[] 7 | } 8 | 9 | export interface PluginKey { 10 | pluginId: PluginID 11 | requiredKeys: KeyValuePair[] 12 | } 13 | 14 | export enum PluginID { 15 | GOOGLE_SEARCH = 'google-search', 16 | } 17 | 18 | export enum PluginName { 19 | GOOGLE_SEARCH = 'Google Search', 20 | } 21 | 22 | export const Plugins: Record = { 23 | [PluginID.GOOGLE_SEARCH]: { 24 | id: PluginID.GOOGLE_SEARCH, 25 | name: PluginName.GOOGLE_SEARCH, 26 | requiredKeys: [ 27 | { 28 | key: 'GOOGLE_API_KEY', 29 | value: '' 30 | }, 31 | { 32 | key: 'GOOGLE_CSE_ID', 33 | value: '' 34 | } 35 | ] 36 | } 37 | }; 38 | 39 | export const PluginList = Object.values(Plugins); 40 | -------------------------------------------------------------------------------- /src/web/types/prompt.ts: -------------------------------------------------------------------------------- 1 | import { type OpenAIModel } from './openai'; 2 | 3 | export interface Prompt { 4 | id: string 5 | name: string 6 | description: string 7 | content: string 8 | model: OpenAIModel 9 | folderId: string | null 10 | } 11 | -------------------------------------------------------------------------------- /src/web/types/query.ts: -------------------------------------------------------------------------------- 1 | export interface Query { 2 | query: string 3 | } 4 | -------------------------------------------------------------------------------- /src/web/types/settings.ts: -------------------------------------------------------------------------------- 1 | export interface Settings { 2 | theme: 'light' | 'dark' 3 | } 4 | -------------------------------------------------------------------------------- /src/web/types/storage.ts: -------------------------------------------------------------------------------- 1 | import { type Conversation } from './chat'; 2 | import { type FolderInterface } from './folder'; 3 | import { type PluginKey } from './plugin'; 4 | import { type Prompt } from './prompt'; 5 | 6 | // keep track of local storage schema 7 | export interface LocalStorage { 8 | apiKey: string 9 | conversationHistory: Conversation[] 10 | selectedConversation: Conversation 11 | theme: 'light' | 'dark' 12 | // added folders (3/23/23) 13 | folders: FolderInterface[] 14 | // added prompts (3/26/23) 15 | prompts: Prompt[] 16 | // added showChatbar and showPromptbar (3/26/23) 17 | showChatbar: boolean 18 | showPromptbar: boolean 19 | // added plugin keys (4/3/23) 20 | pluginKeys: PluginKey[] 21 | } 22 | -------------------------------------------------------------------------------- /src/web/utils/app/api.ts: -------------------------------------------------------------------------------- 1 | import { type Plugin, PluginID } from '@/types/plugin'; 2 | 3 | export const getEndpoint = (plugin: Plugin | null) => { 4 | if (!plugin) { 5 | return 'api/dsensei/answer'; 6 | } 7 | 8 | if (plugin.id === PluginID.GOOGLE_SEARCH) { 9 | return 'api/google'; 10 | } 11 | 12 | return 'api/dsensei/answer'; 13 | }; 14 | -------------------------------------------------------------------------------- /src/web/utils/app/clean.ts: -------------------------------------------------------------------------------- 1 | import { type Conversation } from '@/types/chat'; 2 | import { OpenAIModelID, OpenAIModels } from '@/types/openai'; 3 | 4 | import { DEFAULT_SYSTEM_PROMPT, DEFAULT_TEMPERATURE } from './const'; 5 | 6 | export const cleanSelectedConversation = (conversation: Conversation) => { 7 | // added model for each conversation (3/20/23) 8 | // added system prompt for each conversation (3/21/23) 9 | // added folders (3/23/23) 10 | // added prompts (3/26/23) 11 | // added messages (4/16/23) 12 | 13 | let updatedConversation = conversation; 14 | 15 | // check for model on each conversation 16 | if (!updatedConversation.model) { 17 | updatedConversation = { 18 | ...updatedConversation, 19 | model: updatedConversation.model || OpenAIModels[OpenAIModelID.GPT_3_5] 20 | }; 21 | } 22 | 23 | // check for system prompt on each conversation 24 | if (!updatedConversation.prompt) { 25 | updatedConversation = { 26 | ...updatedConversation, 27 | prompt: updatedConversation.prompt || DEFAULT_SYSTEM_PROMPT 28 | }; 29 | } 30 | 31 | if (!updatedConversation.temperature) { 32 | updatedConversation = { 33 | ...updatedConversation, 34 | temperature: updatedConversation.temperature || DEFAULT_TEMPERATURE 35 | }; 36 | } 37 | 38 | if (!updatedConversation.folderId) { 39 | updatedConversation = { 40 | ...updatedConversation, 41 | folderId: updatedConversation.folderId || null 42 | }; 43 | } 44 | 45 | if (!updatedConversation.messages) { 46 | updatedConversation = { 47 | ...updatedConversation, 48 | messages: updatedConversation.messages || [] 49 | }; 50 | } 51 | 52 | return updatedConversation; 53 | }; 54 | 55 | export const cleanConversationHistory = (history: any[]): Conversation[] => { 56 | // added model for each conversation (3/20/23) 57 | // added system prompt for each conversation (3/21/23) 58 | // added folders (3/23/23) 59 | // added prompts (3/26/23) 60 | // added messages (4/16/23) 61 | 62 | if (!Array.isArray(history)) { 63 | console.warn('history is not an array. Returning an empty array.'); 64 | return []; 65 | } 66 | 67 | return history.reduce((acc: any[], conversation) => { 68 | try { 69 | if (!conversation.model) { 70 | conversation.model = OpenAIModels[OpenAIModelID.GPT_3_5]; 71 | } 72 | 73 | if (!conversation.prompt) { 74 | conversation.prompt = DEFAULT_SYSTEM_PROMPT; 75 | } 76 | 77 | if (!conversation.temperature) { 78 | conversation.temperature = DEFAULT_TEMPERATURE; 79 | } 80 | 81 | if (!conversation.folderId) { 82 | conversation.folderId = null; 83 | } 84 | 85 | if (!conversation.messages) { 86 | conversation.messages = []; 87 | } 88 | 89 | acc.push(conversation); 90 | return acc; 91 | } catch (error) { 92 | console.warn( 93 | 'error while cleaning conversations\' history. Removing culprit', 94 | error 95 | ); 96 | } 97 | return acc; 98 | }, []); 99 | }; 100 | -------------------------------------------------------------------------------- /src/web/utils/app/codeblock.ts: -------------------------------------------------------------------------------- 1 | type languageMap = Record; 2 | 3 | export const programmingLanguages: languageMap = { 4 | javascript: '', 5 | python: '.py', 6 | java: '.java', 7 | c: '.c', 8 | cpp: '.cpp', 9 | 'c++': '.cpp', 10 | 'c#': '.cs', 11 | ruby: '.rb', 12 | php: '.php', 13 | swift: '.swift', 14 | 'objective-c': '.m', 15 | kotlin: '.kt', 16 | typescript: '.ts', 17 | go: '.go', 18 | perl: '.pl', 19 | rust: '.rs', 20 | scala: '.scala', 21 | haskell: '.hs', 22 | lua: '.lua', 23 | shell: '.sh', 24 | sql: '.sql', 25 | html: '.html', 26 | css: '.css' 27 | // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component 28 | }; 29 | 30 | export const generateRandomString = (length: number, lowercase = false) => { 31 | const chars = 'ABCDEFGHJKLMNPQRSTUVWXY3456789'; // excluding similar looking characters like Z, 2, I, 1, O, 0 32 | let result = ''; 33 | for (let i = 0; i < length; i++) { 34 | result += chars.charAt(Math.floor(Math.random() * chars.length)); 35 | } 36 | return lowercase ? result.toLowerCase() : result; 37 | }; 38 | -------------------------------------------------------------------------------- /src/web/utils/app/const.ts: -------------------------------------------------------------------------------- 1 | export const DEFAULT_SYSTEM_PROMPT = 2 | process.env.NEXT_PUBLIC_DEFAULT_SYSTEM_PROMPT || 3 | "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown."; 4 | 5 | export const OPENAI_API_HOST = 6 | process.env.OPENAI_API_HOST || 'https://api.openai.com'; 7 | 8 | export const DEFAULT_TEMPERATURE = 9 | parseFloat(process.env.NEXT_PUBLIC_DEFAULT_TEMPERATURE || '1'); 10 | 11 | export const OPENAI_API_TYPE = 12 | process.env.OPENAI_API_TYPE || 'openai'; 13 | 14 | export const OPENAI_API_VERSION = 15 | process.env.OPENAI_API_VERSION || '2023-03-15-preview'; 16 | 17 | export const OPENAI_ORGANIZATION = 18 | process.env.OPENAI_ORGANIZATION || ''; 19 | 20 | export const AZURE_DEPLOYMENT_ID = 21 | process.env.AZURE_DEPLOYMENT_ID || ''; 22 | -------------------------------------------------------------------------------- /src/web/utils/app/conversation.ts: -------------------------------------------------------------------------------- 1 | import { type Conversation } from '@/types/chat'; 2 | 3 | export const updateConversation = ( 4 | updatedConversation: Conversation, 5 | allConversations: Conversation[] 6 | ) => { 7 | const updatedConversations = allConversations.map((c) => { 8 | if (c.id === updatedConversation.id) { 9 | return updatedConversation; 10 | } 11 | 12 | return c; 13 | }); 14 | 15 | saveConversation(updatedConversation); 16 | saveConversations(updatedConversations); 17 | 18 | return { 19 | single: updatedConversation, 20 | all: updatedConversations 21 | }; 22 | }; 23 | 24 | export const saveConversation = (conversation: Conversation) => { 25 | localStorage.setItem('selectedConversation', JSON.stringify(conversation)); 26 | }; 27 | 28 | export const saveConversations = (conversations: Conversation[]) => { 29 | localStorage.setItem('conversationHistory', JSON.stringify(conversations)); 30 | }; 31 | -------------------------------------------------------------------------------- /src/web/utils/app/folders.ts: -------------------------------------------------------------------------------- 1 | import { type FolderInterface } from '@/types/folder'; 2 | 3 | export const saveFolders = (folders: FolderInterface[]) => { 4 | localStorage.setItem('folders', JSON.stringify(folders)); 5 | }; 6 | -------------------------------------------------------------------------------- /src/web/utils/app/prompts.ts: -------------------------------------------------------------------------------- 1 | import { type Prompt } from '@/types/prompt'; 2 | 3 | export const updatePrompt = (updatedPrompt: Prompt, allPrompts: Prompt[]) => { 4 | const updatedPrompts = allPrompts.map((c) => { 5 | if (c.id === updatedPrompt.id) { 6 | return updatedPrompt; 7 | } 8 | 9 | return c; 10 | }); 11 | 12 | savePrompts(updatedPrompts); 13 | 14 | return { 15 | single: updatedPrompt, 16 | all: updatedPrompts 17 | }; 18 | }; 19 | 20 | export const savePrompts = (prompts: Prompt[]) => { 21 | localStorage.setItem('prompts', JSON.stringify(prompts)); 22 | }; 23 | -------------------------------------------------------------------------------- /src/web/utils/app/settings.ts: -------------------------------------------------------------------------------- 1 | import { type Settings } from '@/types/settings'; 2 | 3 | const STORAGE_KEY = 'settings'; 4 | 5 | export const getSettings = (): Settings => { 6 | let settings: Settings = { 7 | theme: 'dark' 8 | }; 9 | const settingsJson = localStorage.getItem(STORAGE_KEY); 10 | if (settingsJson) { 11 | try { 12 | const savedSettings = JSON.parse(settingsJson) as Settings; 13 | settings = Object.assign(settings, savedSettings); 14 | } catch (e) { 15 | console.error(e); 16 | } 17 | } 18 | return settings; 19 | }; 20 | 21 | export const saveSettings = (settings: Settings) => { 22 | localStorage.setItem(STORAGE_KEY, JSON.stringify(settings)); 23 | }; 24 | -------------------------------------------------------------------------------- /src/web/utils/data/throttle.ts: -------------------------------------------------------------------------------- 1 | export function throttle any>( 2 | func: T, 3 | limit: number 4 | ): T { 5 | let lastFunc: ReturnType; 6 | let lastRan: number; 7 | 8 | return ((...args) => { 9 | if (!lastRan) { 10 | func(...args); 11 | lastRan = Date.now(); 12 | } else { 13 | clearTimeout(lastFunc); 14 | lastFunc = setTimeout(() => { 15 | if (Date.now() - lastRan >= limit) { 16 | func(...args); 17 | lastRan = Date.now(); 18 | } 19 | }, limit - (Date.now() - lastRan)); 20 | } 21 | }) as T; 22 | } 23 | -------------------------------------------------------------------------------- /src/web/utils/server/google.ts: -------------------------------------------------------------------------------- 1 | export const cleanSourceText = (text: string) => { 2 | return text 3 | .trim() 4 | .replace(/(\n){4,}/g, '\n\n\n') 5 | .replace(/\n\n/g, ' ') 6 | .replace(/ {3,}/g, ' ') 7 | .replace(/\t/g, '') 8 | .replace(/\n+(\s*\n)*/g, '\n'); 9 | }; 10 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: [ 4 | './src/web/app/**/*.{js,ts,jsx,tsx}', 5 | './src/web/pages/**/*.{js,ts,jsx,tsx}', 6 | './src/web/components/**/*.{js,ts,jsx,tsx}' 7 | ], 8 | darkMode: 'class', 9 | theme: { 10 | extend: {} 11 | }, 12 | variants: { 13 | extend: { 14 | visibility: ['group-hover'] 15 | } 16 | }, 17 | plugins: [require('@tailwindcss/typography')] 18 | }; 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "./src/**/*", 4 | "../tailwind.config.js" 5 | ], 6 | "exclude": [ 7 | "node_modules", 8 | "src/web" 9 | ], 10 | "compilerOptions": { 11 | "target": "ES2020", 12 | "lib": [ 13 | "dom", 14 | "dom.iterable", 15 | "esnext" 16 | ], 17 | "allowJs": true, 18 | "allowSyntheticDefaultImports": true, 19 | "module": "commonjs", 20 | "outDir": "./dist", 21 | "rootDir": "./src", 22 | "moduleResolution": "node", 23 | "strict": true, 24 | "composite": true, 25 | "types": [ 26 | "node" 27 | ], 28 | "esModuleInterop": true, 29 | "skipLibCheck": true, 30 | "jsx": "preserve", 31 | "forceConsistentCasingInFileNames": true, 32 | "incremental": true, 33 | "resolveJsonModule": true, 34 | "isolatedModules": true, 35 | "noEmit": false, 36 | }, 37 | "references": [ 38 | { 39 | "path": "src/web" 40 | } 41 | ] 42 | } --------------------------------------------------------------------------------