Merge branch 'main' into feature/async-inference

pull/31/head
hanchchch 1 year ago
commit 52f470903c

@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

@ -0,0 +1,11 @@
## :pushpin: Type of PR
<!-- _Bugfix, Feature, Code style update (formatting, local variables), Refactoring (no functional changes, no api changes), Build related changes, CI related changes, Other..._ -->
## :recycle: Current situation
<!-- _Describe the current situation. Explain current problems, if there are any. Be as descriptive as possible (e.g., including examples or code snippets)._ -->
## :bulb: Proposed solution
<!-- _Describe the proposed solution and changes. How does it affect the project? How does it affect the internal structure (e.g., refactorings)?_ -->

@ -120,11 +120,11 @@ Some tools requires environment variables. Set envs depend on which tools you wa
- You can send request to EVAL with `curl` or `httpie`.
```bash
curl -X POST -H "Content-Type: application/json" -d '{"session": "sessionid", "files": ["https://example.com/image.png"], "prompt": "Hi there!"}' http://localhost:8000/command
curl -X POST -H "Content-Type: application/json" -d '{"session": "sessionid", "files": [], "prompt": "Hi there!"}' http://localhost:8000/api/execute
```
```bash
http POST http://localhost:8000/command session=sessionid files:='["https://example.com/image.png"]' prompt="Hi there!"
http POST http://localhost:8000/api/execute session=sessionid files:='[]' prompt="Hi there!"
```
- We are planning to make a GUI for EVAL so you can use it without terminal.

@ -11,6 +11,7 @@
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ"
crossorigin="anonymous"
/>
<link rel="icon" href="{{ url_for('static', path='/eval.png') }}" />
{% block head %} {% endblock %}
</head>
<body>
@ -24,6 +25,11 @@
<svg class="bi me-2" width="40" height="32">
<use xlink:href="#bootstrap"></use>
</svg>
<img
class="logo"
src="{{ url_for('static', path='/eval.png') }}"
alt="logo"
/>
<span class="fs-4">EVAL</span>
</a>
<ul class="nav nav-pills">

@ -1,9 +1,10 @@
import os
import uuid
import shutil
from pathlib import Path
import uuid
from enum import Enum
from pathlib import Path
from typing import Dict
import requests
from env import settings
@ -77,8 +78,9 @@ class FileHandler:
def handle(self, url: str) -> str:
try:
if url.startswith(settings["SERVER"]):
local_filename = url[len(settings["SERVER"]) + 1 :]
src = self.path / local_filename
local_filepath = url[len(settings["SERVER"]) + 1 :]
local_filename = Path("file") / local_filepath.split("/")[-1]
src = self.path / local_filepath
dst = self.path / settings["PLAYGROUND_DIR"] / local_filename
os.makedirs(os.path.dirname(dst), exist_ok=True)
shutil.copy(src, dst)
@ -86,4 +88,4 @@ class FileHandler:
local_filename = self.download(url)
return self.handlers[FileType.from_url(url)].handle(local_filename)
except Exception as e:
return "Error: " + str(e)
raise e

@ -37,7 +37,7 @@ EVAL_SUFFIX = """TOOLS
{bot_name} can ask the user to use tools to look up information that may be helpful in answering the users original question.
You are very strict to the filename correctness and will never fake a file name if it does not exist.
You will remember to provide the file name loyally if it's provided in the last tool observation.
If you have to include files in your response, you must provide the filepath in [file://filepath] format.
If you have to include files in your response, you must provide the filepath in [file://filepath] format. It must be wrapped in square brackets.
The tools the human can use are:

@ -90,23 +90,23 @@ class CodeEditor(BaseToolSet):
)
return output
@tool(
name="CodeEditor.PATCH",
description="Patch the code to correct the error if an error occurs or to improve it. "
"Input is a list of patches. The patch is separated by {seperator}. ".format(
seperator=CodePatcher.separator.replace("\n", "\\n")
)
+ "Each patch has to be formatted like below.\n"
"<filepath>|<start_line>,<start_col>|<end_line>,<end_col>|<new_code>"
"Here is an example. If the original code is:\n"
"print('hello world')\n"
"and you want to change it to:\n"
"print('hi corca')\n"
"then the patch should be:\n"
"test.py|1,8|1,19|hi corca\n"
"Code between start and end will be replaced with new_code. "
"The output will be written/deleted bytes or error message. ",
)
# @tool(
# name="CodeEditor.PATCH",
# description="Patch the code to correct the error if an error occurs or to improve it. "
# "Input is a list of patches. The patch is separated by {seperator}. ".format(
# seperator=CodePatcher.separator.replace("\n", "\\n")
# )
# + "Each patch has to be formatted like below.\n"
# "<filepath>|<start_line>,<start_col>|<end_line>,<end_col>|<new_code>"
# "Here is an example. If the original code is:\n"
# "print('hello world')\n"
# "and you want to change it to:\n"
# "print('hi corca')\n"
# "then the patch should be:\n"
# "test.py|1,8|1,19|hi corca\n"
# "Code between start and end will be replaced with new_code. "
# "The output will be written/deleted bytes or error message. ",
# )
def patch(self, patches: str) -> str:
try:
w, d = CodePatcher.patch(patches)

@ -4,6 +4,8 @@ write protocol:
<filepath>
<content>
"""
import os
from .verify import verify
@ -21,6 +23,9 @@ class WriteCommand:
@verify
def execute(self) -> str:
dir_path = os.path.dirname(self.filepath)
if dir_path:
os.makedirs(dir_path, exist_ok=True)
with open(self.filepath, self.mode) as f:
f.write(self.content)
return self.content

@ -1,6 +1,7 @@
import os
import shutil
from pathlib import Path
from env import DotEnv
from .base import AbstractUploader

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

@ -9,3 +9,19 @@ const highlightActiveNavItem = () => {
};
highlightActiveNavItem();
const getNumber = (str) => Number(str.replace("px", ""));
function expandTextarea(id) {
document.getElementById(id).addEventListener(
"keyup",
function () {
this.style.overflow = "hidden";
this.style.height =
Math.max(getNumber(this.style.height), this.scrollHeight) + "px";
},
false
);
}
expandTextarea("prompt");

@ -0,0 +1,7 @@
.logo {
border-radius: 50%;
overflow: hidden;
height: 64px;
width: 64px;
margin-right: 20px;
}
Loading…
Cancel
Save