├── data └── res.json ├── .browserslistrc ├── public ├── icon.png ├── favicon.ico └── index.html ├── src ├── assets │ ├── logo.png │ └── tailwind.css ├── shims-vue.d.ts ├── helpers │ └── index.ts ├── components │ ├── Result.vue │ ├── misc │ │ ├── Error.vue │ │ ├── Warning.vue │ │ ├── InputApiKey.vue │ │ ├── list │ │ │ ├── Loader.vue │ │ │ ├── ListAdd.vue │ │ │ ├── ListAddLine.vue │ │ │ └── List.vue │ │ ├── FileTree.vue │ │ ├── IconFolder.vue │ │ ├── Accordeon.vue │ │ ├── InputTextarea.vue │ │ ├── ToggleSwitch.vue │ │ └── InputText.vue │ ├── insight │ │ ├── ProjectsList.vue │ │ ├── FileInsight.vue │ │ ├── Cycles.vue │ │ ├── SavedResults.vue │ │ ├── FilesInsight.vue │ │ ├── ContentInsight.vue │ │ ├── ResultFiles.vue │ │ └── Result.vue │ ├── Info.vue │ ├── ProjectDescription.vue │ ├── Examples.vue │ ├── Config.vue │ ├── File.vue │ ├── TheFooter.vue │ ├── Files.vue │ ├── Settings.vue │ ├── TabDocs.vue │ └── TabInsight.vue ├── main.ts ├── controllers │ └── externalRoutes.ts ├── background.ts └── App.vue ├── babel.config.js ├── postcss.config.js ├── .editorconfig ├── vue.config.js ├── tailwind.config.js ├── types └── index.ts ├── .gitignore ├── pyScripts └── countTokens.py ├── serve.ps1 ├── tsconfig.json ├── engine ├── cli_insight.ts ├── api.ts ├── cli.ts ├── insight.ts ├── cli_update.ts └── index.ts ├── docs.ai.config.json ├── package.json ├── .eslintrc.js ├── README.md ├── helpers ├── index.ts └── node_gm.ts └── docs.ai.json /data/res.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /public/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kypaku/gpt-project-insight/HEAD/public/icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kypaku/gpt-project-insight/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kypaku/gpt-project-insight/HEAD/src/assets/logo.png -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /src/assets/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | 3 | @tailwind components; 4 | 5 | @tailwind utilities; 6 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {} 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pluginOptions: { 3 | electronBuilder: { 4 | nodeIntegration: true, // <--- added 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | declare module '*.vue' { 3 | import type { DefineComponent } from 'vue' 4 | const component: DefineComponent<{}, {}, any> 5 | export default component 6 | } 7 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ['./public/**/*.html', './src/**/*.{vue,js,ts,jsx,tsx}'], 4 | theme: { 5 | extend: {} 6 | }, 7 | plugins: [] 8 | } 9 | -------------------------------------------------------------------------------- /types/index.ts: -------------------------------------------------------------------------------- 1 | import { DescriptionResponse } from "../engine/api" 2 | 3 | export interface IFile { 4 | fullPath?: string 5 | path: string 6 | size?: number 7 | description?: string 8 | state?: 'queued' | 'pending' | 'done' | 'error' | 'stopped' 9 | prompt?: string 10 | used?: boolean 11 | promise?: Promise 12 | content?: string 13 | } 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | docs.ai.config.json 25 | 26 | #Electron-builder output 27 | /dist_electron 28 | 29 | /out_engine 30 | data -------------------------------------------------------------------------------- /pyScripts/countTokens.py: -------------------------------------------------------------------------------- 1 | from tiktoken import Tokenizer 2 | from tiktoken.tokenizer import TokenizerConfig 3 | from typing import List 4 | 5 | def count_tokens(text: str) -> int: 6 | tokenizer = Tokenizer() 7 | try: 8 | tokens = list(tokenizer.tokenize(text)) 9 | return len(tokens) 10 | except TokenizerException as e: 11 | print(f"Error: {e}") 12 | return 0 13 | 14 | text = sys.argv[1] 15 | token_count = count_tokens(text) 16 | print(f"Количество токенов: {token_count}") -------------------------------------------------------------------------------- /serve.ps1: -------------------------------------------------------------------------------- 1 | Add-Type -TypeDefinition @" 2 | using System; 3 | using System.Runtime.InteropServices; 4 | 5 | public class Win32 { 6 | [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] 7 | public static extern bool SetConsoleTitle(string lpConsoleTitle); 8 | } 9 | "@ 10 | 11 | function Set-ConsoleTitle ($title) { 12 | [Win32]::SetConsoleTitle($title) 13 | } 14 | 15 | Start-Process npm -ArgumentList 'run electron:serve' -NoNewWindow 16 | $dirName = Split-Path -Path $PSScriptRoot -Leaf 17 | Start-Sleep -Seconds 5 18 | Set-ConsoleTitle "Dev: $dirName" -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | GPTProjectsInsight 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/helpers/index.ts: -------------------------------------------------------------------------------- 1 | const { exec } = require('child_process') 2 | const fs = require('fs') 3 | const path = require('path') 4 | 5 | export const ROOT_DIR = path.resolve(__dirname, '..', '..', '..', '..', '..', '..') 6 | // replace all files in text with string file 7 | export function wrapFilesInString(text: string, files: string[]): string { 8 | return text.replaceAll(new RegExp(files.join('|'), 'g'), (match) => { 9 | return `${match}` 10 | }) 11 | } 12 | 13 | export function indexesOf(string: string, substring: string): number[] { 14 | const a = []; let i = -1 15 | while ((i = string.indexOf(substring, i + 1)) >= 0) a.push(i) 16 | return a 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/components/Result.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 34 | 35 | 38 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import App from './App.vue' 3 | import './assets/tailwind.css' 4 | import shell, { ipcRenderer } from 'electron' 5 | import { handleExternalRoutes } from './controllers/externalRoutes' 6 | import Vue3Toasity from 'vue3-toastify' 7 | import 'vue3-toastify/dist/index.css' 8 | 9 | const app = createApp(App) 10 | .use(Vue3Toasity) 11 | .mount('#app') 12 | 13 | document.addEventListener('keydown', function (e) { 14 | if (e.which === 123) { 15 | shell.remote.getCurrentWindow().webContents.toggleDevTools() 16 | } else if (e.which === 116) { 17 | location.reload() 18 | } 19 | }) 20 | 21 | ipcRenderer.on('data', async function (evt, message) { 22 | if (message.externalRoute) { 23 | await handleExternalRoutes(app, message.externalRoute) 24 | } 25 | }) 26 | -------------------------------------------------------------------------------- /src/components/misc/Error.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 35 | 36 | 39 | -------------------------------------------------------------------------------- /src/components/misc/Warning.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 36 | 37 | 40 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "strict": false, 6 | "jsx": "preserve", 7 | "importHelpers": true, 8 | "moduleResolution": "node", 9 | "skipLibCheck": true, 10 | "esModuleInterop": true, 11 | "allowSyntheticDefaultImports": true, 12 | "noStrictGenericChecks": true, 13 | "sourceMap": true, 14 | "baseUrl": ".", 15 | "types": [ 16 | "webpack-env" 17 | ], 18 | "paths": { 19 | "@/*": [ 20 | "src/*" 21 | ] 22 | }, 23 | "lib": [ 24 | "esnext", 25 | "dom", 26 | "dom.iterable", 27 | "scripthost" 28 | ] 29 | }, 30 | "include": [ 31 | "src/**/*.ts", 32 | "src/**/*.tsx", 33 | "src/**/*.vue", 34 | "tests/**/*.ts", 35 | "tests/**/*.tsx" 36 | ], 37 | "exclude": [ 38 | "node_modules", 39 | "helpers/node_gm.js" 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /src/components/insight/ProjectsList.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 39 | 40 | 43 | -------------------------------------------------------------------------------- /src/components/misc/InputApiKey.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 39 | 40 | 43 | -------------------------------------------------------------------------------- /src/components/Info.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 43 | 44 | 47 | -------------------------------------------------------------------------------- /src/components/ProjectDescription.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 41 | 42 | 45 | -------------------------------------------------------------------------------- /engine/cli_insight.ts: -------------------------------------------------------------------------------- 1 | 2 | import { program } from 'commander' 3 | import { Insight } from './insight' 4 | 5 | program 6 | .option('--fileNames ', 'The list of file names') 7 | .option('--mode ', 'The mode of insight') 8 | .parse(process.argv) 9 | 10 | const prompt = process.argv[3] 11 | const apiKey = process.argv[2] 12 | 13 | async function main(prompt: string) { 14 | const cliOptions = program.opts() 15 | const fileNames = cliOptions?.fileNames.split(",") 16 | const mode = cliOptions?.mode 17 | 18 | const options = { 19 | apiKey, 20 | cli: true, 21 | fileNames, 22 | mode 23 | } 24 | 25 | const insight = new Insight([], options) 26 | const res = await insight.insight(prompt, options) 27 | console.log("The result:", res) 28 | } 29 | 30 | // Wrap your async function in an async IIFE 31 | (async () => { 32 | try { 33 | await main(prompt) 34 | } catch (error) { 35 | console.error('Error occurred:', error) 36 | process.exit(1) 37 | } 38 | console.log('Async function completed successfully') 39 | process.exit(0) 40 | })() 41 | -------------------------------------------------------------------------------- /src/components/misc/list/Loader.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 32 | 33 | 56 | -------------------------------------------------------------------------------- /docs.ai.config.json: -------------------------------------------------------------------------------- 1 | {"excludes":"*.ps1, .vscode, assets, out, .browserslistrc, .editorconfig, .eslintrc.js, .gitignore, .vscode\\settings.json, babel.config.js, build.ps1, build_engine.ps1, postcss.config.js, dist, docs.ai.config.json, docs.ai.json, public\\favicon.ico, public\\icon.png, public\\index.html, serve.ps1, data\\res.json, src\\assets\\logo.png, src\\assets\\tailwind.css, src\\shims-vue.d.ts, tailwind.config.js, tsconfig.json, vue.config.js, components\\common\\Accordeon.vue, components\\common\\Dropdown.vue, components\\common\\InputCheckbox.vue, components\\common\\list\\ListAdd.vue, components\\common\\list\\ListAddLine.vue, components\\common\\list\\List.vue, i18n\\en.json, i18n.ts, shims-vue.d.ts, src\\components\\misc\\Accordeon.vue, src\\components\\misc\\FileTree.vue, src\\components\\misc\\IconFolder.vue, src\\components\\misc\\InputText.vue, src\\components\\Result.vue, pyScripts\\countTokens.py, src\\components\\misc\\list\\List.vue, src\\components\\misc\\list\\ListAdd.vue, src\\components\\misc\\list\\ListAddLine.vue, src\\components\\misc\\list\\Loader.vue, src\\components\\misc\\ToggleSwitch.vue, src\\components\\misc\\Warning.vue, src\\components\\misc\\Error.vue, src\\components\\misc\\InputApiKey.vue, .vsixmanifest, *.png, *.svg, webpack.config.js","temperature":0.2,"model":"gpt-4","maxTokensModel":8192,"maxTokensDir":400,"maxTokensFile":200,"documentationTimeout":40000,"insightTimeout":300000} -------------------------------------------------------------------------------- /src/components/Examples.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 45 | 46 | 49 | -------------------------------------------------------------------------------- /src/components/misc/list/ListAdd.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 48 | 49 | 52 | -------------------------------------------------------------------------------- /src/components/misc/FileTree.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 46 | -------------------------------------------------------------------------------- /src/controllers/externalRoutes.ts: -------------------------------------------------------------------------------- 1 | import { ComponentOptionsBase, ComponentPublicInstance } from "vue" 2 | import ls from 'local-storage' 3 | 4 | function getQueryParams(url) { 5 | const params = {} 6 | const queryString = url.split("?")[1] 7 | if (!queryString) { 8 | return params 9 | } 10 | const keyValuePairs = queryString.split("&") 11 | keyValuePairs.forEach(keyValuePair => { 12 | const [key, value] = keyValuePair.split("=") 13 | params[key] = decodeURIComponent(value) 14 | }) 15 | return params 16 | } 17 | 18 | export async function handleExternalRoutes(app: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase, {}>, route: string) { 19 | const path = route.replace('gptpi://', '') 20 | const parts = path.split('/') 21 | const params = getQueryParams(path) as any 22 | if (params.dir) { 23 | ls("dir", params.dir); 24 | (app.$root as any).dir = params.dir; 25 | (app.$root as any).updateFilesSync(params.dir) 26 | } 27 | if ((params.result && app.$root.$refs?.tabInsight as any)?.loadResult) { 28 | setTimeout(() => { 29 | (app.$root.$refs.tabInsight as any).loadResult(params.result) 30 | }, 0) 31 | } 32 | if (params.config) { 33 | setTimeout(() => { 34 | (app.$root as any).loadConfigRaw(params.config) 35 | }, 0) 36 | } 37 | if (params.prompt) { 38 | setTimeout(() => { 39 | (app.$root.$refs.tabInsight as any).prompt = params.prompt 40 | }, 500) 41 | } 42 | if (params.filesContent) { 43 | setTimeout(() => { 44 | (app.$root.$refs.tabInsight as any).includeFilesContent(params.filesContent.split(',')) 45 | }, 0) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/components/misc/list/ListAddLine.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 49 | 50 | 70 | -------------------------------------------------------------------------------- /src/components/misc/IconFolder.vue: -------------------------------------------------------------------------------- 1 | 19 | -------------------------------------------------------------------------------- /src/components/insight/FileInsight.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 54 | 55 | 58 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "recursive-documentation", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint", 9 | "electron:build": "vue-cli-service electron:build", 10 | "electron:serve": "vue-cli-service electron:serve", 11 | "postinstall": "electron-builder install-app-deps", 12 | "postuninstall": "electron-builder install-app-deps" 13 | }, 14 | "main": "background.js", 15 | "dependencies": { 16 | "autoprefixer": "^9.8.8", 17 | "commander": "^10.0.0", 18 | "core-js": "^3.6.5", 19 | "eventsource-parser": "^1.0.0", 20 | "gpt-simple-api-ts": "^1.0.37", 21 | "https-browserify": "^1.0.0", 22 | "local-storage": "^2.0.0", 23 | "postcss": "^7.0.39", 24 | "prismjs": "^1.29.0", 25 | "readline": "^1.3.0", 26 | "stream-http": "^3.2.0", 27 | "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17", 28 | "vue": "^3.0.0", 29 | "vue-draggable-next": "^2.2.0", 30 | "vue3-toastify": "^0.1.11" 31 | }, 32 | "devDependencies": { 33 | "@types/electron-devtools-installer": "^2.2.0", 34 | "@typescript-eslint/eslint-plugin": "^4.18.0", 35 | "@typescript-eslint/parser": "^4.18.0", 36 | "@vue/cli-plugin-babel": "~4.5.0", 37 | "@vue/cli-plugin-eslint": "~4.5.0", 38 | "@vue/cli-plugin-typescript": "~4.5.0", 39 | "@vue/cli-service": "~4.5.0", 40 | "@vue/compiler-sfc": "^3.0.0", 41 | "@vue/eslint-config-standard": "^5.1.2", 42 | "@vue/eslint-config-typescript": "^7.0.0", 43 | "electron": "^13.6.9", 44 | "electron-devtools-installer": "^3.1.0", 45 | "eslint": "^6.7.2", 46 | "eslint-plugin-import": "^2.20.2", 47 | "eslint-plugin-node": "^11.1.0", 48 | "eslint-plugin-promise": "^4.2.1", 49 | "eslint-plugin-standard": "^4.0.0", 50 | "eslint-plugin-vue": "^7.0.0", 51 | "sass": "^1.26.5", 52 | "sass-loader": "^8.0.2", 53 | "typescript": "~4.1.5", 54 | "vue-cli-plugin-electron-builder": "~2.1.1", 55 | "vue-cli-plugin-tailwind": "~3.0.0" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/components/Config.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 56 | 57 | 64 | -------------------------------------------------------------------------------- /src/components/misc/Accordeon.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 52 | -------------------------------------------------------------------------------- /src/components/File.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 62 | 63 | 73 | -------------------------------------------------------------------------------- /src/components/TheFooter.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 80 | 81 | 88 | -------------------------------------------------------------------------------- /src/components/misc/InputTextarea.vue: -------------------------------------------------------------------------------- 1 |