Together-Java / JShellPlaygroundBackend

GNU General Public License v3.0
2 stars 2 forks source link

Allow to supply an optional prefix to single eval endpoint. #53

Open Alathreon opened 2 weeks ago

Alathreon commented 2 weeks ago

The reason it doesn't take an id, is so it can't be called a second time. But it's often hard to tell who used which single eval endpoint. So allowing to supply a prefix would help tell who sent it.

Currently, the name of the session would be an uuid like 8ea0dc84-c4ce-4e20-8444-5c57d340c0cb. But with this change, it could have an optional prefix in order to end up like this john_8ea0dc84-c4ce-4e20-8444-5c57d340c0cb

Implementation note : the prefix must be validated with a similar regex to JShellController#validateId(String), but shouldn't allow any underscore, so underscore can be used to separate the prefix to the uuid.

Andrew1031 commented 1 week ago

When is the single eval endpoint being triggered? Like what discord command triggers it?

I know the "/jshell eval code" discord command triggers the /eval endpoint. But it seems like jshell single eval doesn't have anything that triggers it?

The only way to trigger single eval (from what I understand) is by editing a message that had code, that was previously evaluated through the "/jshell eval code" command. But it deletes the original message after running that command, so we can't edit the original message; therefore jshell single-eval never gets triggered?

Its also not detecting my message as code when I don't use the /jshell command and I paste my code in

Am I missing something here?

image For example in image above I can't edit my original message "jshell eval code: System.out.println("HELLO");"