Code Monkey home page Code Monkey logo

kaguya's Introduction

Kaguya

Kaguya is a ChatGPT plugin that allows you to load and edit your local files in a controlled way, as well as run any Python, JavaScript, and bash script. This makes it a powerful tool for developers, enabling them to interact with their file system and run scripts directly from ChatGPT. To interact with Kaguya, you'll need access to plugin devtools by getting on their waitlist here. In case this approach doesn't work for you, we may be able to come up with a more open approach at some point in the future.

Demo

Here are a few demo videos of Kaguya:

C7GcV0-YN6Pt6CnI.mp4
FchDrHVGdP2WVWsn.mp4

Getting Started Guide

  1. Gain access to OpenAI's plugin devtools for ChatGPT here
  2. Install Docker and run it locally
  3. Clone this repo to your local environment
  4. Execute docker.sh script
  5. Setup localhost port 3000
  6. Interact with Kaguya through ChatGPT
  7. If you want Kaguya to be able to interact with your files, put them in the FILES folder.
  8. Note: Kaguya won't have access to files outside of its own directory.

Recommended Custom Instructions

When editing a file, use search and replace and NOT updateWholeFile unless we're dealing with a very small file. Confirm with me before you edit a file.

When you have output from Kaguya, there's no need to repeat everything from there. Instead, you can summarize it concisely.

When you want to use executeCommand in a subdirectory, make sure to cd there first every time.

API Endpoints

The project provides several API endpoints that allow you to interact with the file system within the Kaguya directory. The API is described in the openapi.yaml file. Here is a brief overview:

  • GET /api/listFilesInDirectory: List files and directories in the specified directory. Defaults to FILES.
  • GET /api/readFile: Read the content of a file in the user's directory.
  • GET /api/readMultipleFiles: Read the content of multiple files.
  • POST /api/update: Update a file in the user's directory by performing a search-and-replace operation.
  • POST /api/updateAll: Update a file in the user's directory by performing a search-and-replace operation (all occurrences).
  • POST /api/updateWholeFile: Replace the entire content of a file in the user's directory.
  • POST /api/appendToFile: Append content to the end of an existing file.
  • POST /api/createFile: Create a new file.
  • POST /api/deleteFile: Delete a file in the user's directory.
  • POST /api/renameFile: Rename a file in the user's directory.
  • POST /api/createDirectory: Create a new directory.
  • POST /api/deleteDirectory: Delete a directory and its contents.
  • POST /api/executeCommand: Execute a shell command.

Tips

  • If listFilesInDirectory tries to show too many files, a good solution would be to add a git repo or submodule, in which files in .gitignore are ignored.
  • Best to keep each file under 100 lines of code, particularly for writing
  • Writing more than ~80 lines of code at once is not recommended. It's slow and it might not even be able to finish the task.
  • You can have it read more code though. However, reading more than 500-600 lines of code at once is not recommended.
  • If the target file you want to edit is long, you may want to explicitly ask it to use search and replace and NOT updateWholeFile.
  • It may not get the intention of your instructions right away. It's meant to be a conversational tool.
  • If the assistant starts hallucinating, it may be helpful to start a new conversation or limit the length of each file being loaded.

Discord

Feel free to join our Discord server here.

VS Code Extension

We're also working on a VS Code extension version of Kaguya. Feel free to sign up for the waitlist here.

kaguya's People

Contributors

andrewpap22 avatar dave1010 avatar eltociear avatar ignacio-r avatar kushaldabbe avatar pushkaraj2007 avatar thirdecade2020 avatar ykdojo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kaguya's Issues

ERROR: failed to solve: executor failed running

I've been trying to run this and for the life of me I cannot figure out a fix. I'm positive I'm overlooking something.

This is the output when I run the docker.sh:

0.72 Setting up python3.9-minimal (3.9.2-1) ...
30.79 Traceback (most recent call last):
30.79   File "/usr/lib/python3.9/py_compile.py", line 215, in <module>
30.79     sys.exit(main())
30.79   File "/usr/lib/python3.9/py_compile.py", line 207, in main
30.79     compile(filename, doraise=True)
30.79   File "/usr/lib/python3.9/py_compile.py", line 172, in compile
30.79     importlib._bootstrap_external._write_atomic(cfile, bytecode, mode)
30.79   File "<frozen importlib._bootstrap_external>", line 126, in _write_atomic
30.79 PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.9/__pycache__/__future__.cpython-39.pyc.139771950211344'
30.79 dpkg: error processing package python3.9-minimal (--configure):
30.79  installed python3.9-minimal package post-installation script subprocess returned error exit status 1
30.80 Errors were encountered while processing:
30.80  python3.9-minimal
30.85 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
ERROR: failed to solve: executor failed running [/bin/sh -c apt-get update &&     apt-get install -y wget gnupg &&     wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &&     echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list &&     apt-get update &&     apt-get install -y     python3 python3-pip git curl build-essential gfortran ffmpeg firefox-esr unzip     google-chrome-stable &&     apt-get clean &&     rm -rf /var/lib/apt/lists/*]: exit code: 100
docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.

It seemed to keep hanging and erroring out at:

=> [ 6/16] RUN apt-get update && apt-get install -y python3 python3-pip git curl build-essential gfortran && apt-get clean && rm -rf /var/lib/apt/lists/*

Any ideas on what could be going on?

Unable to Start Under Ubuntu 23.x

=> => writing image sha256:0d5e90bae6e6ca47d571e4e99542de91525e1643d6fcddabc41aae053ddbef21 0.0s
=> => naming to docker.io/library/kaguya 0.0s

[email protected] dev /kaguya
if [ -f /.dockerenv ]; then next dev; else echo 'Error: Please run this script inside a Docker container.' && exit 1; fi

Watchpack Error (watcher): Error: EACCES: permission denied, watch '/root'
Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/root'
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
[Error: EACCES: permission denied, mkdir '/kaguya/.next'] {
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/kaguya/.next'
}

Organize README a bit better

Move the API endpoints section into a separate file and add more details about how to get started with Kaguya - install it as a ChatGPT plugin and move all files you want ChatGPT to have access to, to the FILES directory.

Add these tips in README

  • Best to keep each file under 100 lines of code, particularly for writing
  • Writing more than ~80 lines of code at once is not recommended. It's slow and it might not even be able to finish the task.
  • You can have it read more code though. However, reading more than 500-600 lines of code at once is not recommended.
  • If the target file you want to edit is long, you may want to explicitly ask it to use search and replace.
  • It may not get the intention of your instructions right away. It's meant to be a conversational tool.
  • If the assistant starts hallucinating, it may be helpful to start a new conversation or limit the length of each file being loaded.

Docker produces error on Windows

Running the docker application on Windows 10 produces the following error:

> hako-next@0.1.0 dev /kaguya
> if [ -f /.dockerenv ]; then next dev; else echo 'Error: Please run this script inside a Docker container.' && exit 1; fi
Watchpack Error (watcher): Error: EACCES: permission denied, watch '/root'
Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/root'
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
error - Project directory could not be found, restart Next.js in your new directory

Docker only brings me to "create next app" homepage

this makes sense given the files. however, this means the app is not built. Am i correct? I wanted to use this but it seems the code is missing lol

if I am just super early or something, that is cool! just now sure what is going on here as there is not any code representative of your demos. Am I doing something wrong?

Recording.2023-06-22.081515.mp4

Integrating Kaguya as a GPTs Action Due to HTTP/HTTPS Mismatch

I am attempting to integrate Kaguya with GPTs as an action, but I am encountering an issue related to the HTTP and HTTPS protocols.

Steps to Reproduce:

  1. I ran the Kaguya plugin and successfully accessed it at http://localhost:3000.

  2. I copied the contents from http://localhost:3000/openapi.yaml and pasted it into GPTs actions.

  3. Upon doing so, I received the following warnings:

    Warnings
    None of the provided servers is under the root origin https://localhost
    Server URL http://localhost:3000 is not under the root origin https://localhost; ignoring it
    

Issue:
It appears that there is a protocol mismatch issue, as Kaguya is running on HTTP and GPTs actions seem to require HTTPS. As a result, the server URL is being ignored due to not being under the root origin https://localhost.

Questions:

  1. Has anyone successfully integrated Kaguya as an action in GPTs?
  2. Although Kaguya is originally intended as a ChatGPT plugin, I believe there should be a close similarity in its integration with GPTs. If it is indeed feasible to run it as a GPTs action, how should the yaml be modified to address the HTTP/HTTPS protocol mismatch?

Any guidance or suggestions on resolving this issue would be greatly appreciated. Thank you for your support and for the development of this innovative tool.

Best regards,

Add a recommended custom instruction on README

Now that OpenAI has Custom Instructions (a persistent instruction for new conversations), we should show a recommended custom instruction on README.

Currently, I have this:

When editing a file, use search and replace and NOT updateWholeFile unless we're dealing with a very small file. Confirm with me before you edit a file.

When you have output from Kaguya, there's no need to repeat everything from there. Instead, you can summarize it concisely.

When you want to use executeCommand in a subdirectory, make sure to cd there first every time.

I might refine it as I go, but it should be good enough for now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.