GithubHelp home page GithubHelp logo

Comments (17)

rany2 avatar rany2 commented on May 18, 2024 1

Fantastic, thank you. That's a fast pace!

from dalai.

bernatvadell avatar bernatvadell commented on May 18, 2024

fixed in PR #39

from dalai.

rany2 avatar rany2 commented on May 18, 2024

I don't see anywhere in your change where you escape shell input. I'd much prefer if the prompt was in a file instead

from dalai.

bernatvadell avatar bernatvadell commented on May 18, 2024

after the change in textarea and the responses encapsulate them in "

" I am not having problems with the escaped characters:

image

from dalai.

rany2 avatar rany2 commented on May 18, 2024

@bernatvadell There is no way your change made a difference. Try with a single-quote to get it to obviously not work. If you end up closing the quote it does work, sure but try to put anything special like $, `, ", <, etc... it does NOT work and gets passed as is to bash.

image

from dalai.

rany2 avatar rany2 commented on May 18, 2024

If you need a description, $(ls) ended up just running and the output of ls got sent to the model. This is not what should happen under any circumstances...

from dalai.

rany2 avatar rany2 commented on May 18, 2024

IMHO the most proper way to get around this is to put the prompt in some temp file and have the model read from it (using LLAMA's -f). I recommend against trying to escape because there will always be edge cases you will miss and it might be a hit or miss across different shells, OSes, etc... putting it in a file is a universal fix so to speak

from dalai.

bernatvadell avatar bernatvadell commented on May 18, 2024

I think we should use the "args" to be able to correctly escape the input.

image

from dalai.

rany2 avatar rany2 commented on May 18, 2024

@bernatvadell Yes that would be ideal, no idea why it is spawning in a shell...

from dalai.

bernatvadell avatar bernatvadell commented on May 18, 2024

I imagine it would be possible to import the llama.cpp project as a library, I haven't looked into it, and right now, as far as I know, it's published as a console program.

from dalai.

bernatvadell avatar bernatvadell commented on May 18, 2024

Finally, I have needed to escape the characters, the ones that I have verified that give problems are these:
image

This seems to work correctly:
image

The change is in the TypeScript PR #44

from dalai.

rany2 avatar rany2 commented on May 18, 2024

Why do you escape when you could just call exec directly? You don't need to exec it in a shell ..

from dalai.

bernatvadell avatar bernatvadell commented on May 18, 2024

Why do you escape when you could just call exec directly? You don't need to exec it in a shell ..

Originally it was like this, I'm going to try what you say.

from dalai.

rany2 avatar rany2 commented on May 18, 2024

Anyway this proposal makes me a bit uneasy because in different shells you need to escape different things. For example if user was using fish, then (ls) would execute also. Best solution IMO is to just put the prompt in a file or use whatever the programming language offers to execute a program without relying on a shell (while allowing you to define arguments as an array of strings of course)

Edit: also if this was a Windows user then none of your escaping would be relevant.

from dalai.

bernatvadell avatar bernatvadell commented on May 18, 2024

Atm we're forcing to use powershell or bash:

image

from dalai.

rany2 avatar rany2 commented on May 18, 2024

Is executing it in a shell still needed? I think you could call node's spawn directly now.

from dalai.

bernatvadell avatar bernatvadell commented on May 18, 2024

it works quite well.

image

Now directly spawns the process, the arguments do not need to be sanitized manually.

the prompt is stored in a temporary file.

image

You can change default directory to store temporal prompts:

   this.tempPromptsPath =
      process.env.TEMP_PROMPTS_PATH ?? path.resolve(os.tmpdir(), "prompt-tmp");

from dalai.

Related Issues (20)

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.