mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-20 07:04:20 +01:00
feat: frontend
This commit is contained in:
4
main.py
4
main.py
@@ -62,10 +62,12 @@ async def main(
|
|||||||
recreate_folder(EXECUTOR_FOLDER)
|
recreate_folder(EXECUTOR_FOLDER)
|
||||||
system_definition = (
|
system_definition = (
|
||||||
"You are a principal engineer working at Jina - an open source company."
|
"You are a principal engineer working at Jina - an open source company."
|
||||||
"Using the Jina framework, users can define executors."
|
"Using the Jina framework, users can define executors. "
|
||||||
+ executor_example
|
+ executor_example
|
||||||
+ docarray_example
|
+ docarray_example
|
||||||
+ client_example
|
+ client_example
|
||||||
|
+ "The user is asking you to create an executor with all the necessary files "
|
||||||
|
"and you write the complete code without leaving something out. "
|
||||||
)
|
)
|
||||||
|
|
||||||
user_query = (
|
user_query = (
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import {Box, Button, Container, FormControl, InputLabel, MenuItem, Select, TextField, Typography,} from '@mui/material';
|
import {Box, Container, FormControl, InputLabel, MenuItem, Select, TextField, Typography,} from '@mui/material';
|
||||||
|
import copy from 'clipboard-copy';
|
||||||
|
import Button from '@mui/material/Button';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [executorName, setExecutorName] = useState('MyCoolOcrExecutor');
|
const [executorName, setExecutorName] = useState('MyCoolOcrExecutor');
|
||||||
@@ -30,6 +32,7 @@ function App() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.post('http://0.0.0.0:8000/create', requestBody);
|
const response = await axios.post('http://0.0.0.0:8000/create', requestBody);
|
||||||
|
console.log(response.data)
|
||||||
setResponseText(response.data);
|
setResponseText(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@@ -37,6 +40,9 @@ function App() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCopy = (fileContent) => {
|
||||||
|
copy(fileContent);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container maxWidth="md">
|
<Container maxWidth="md">
|
||||||
@@ -165,16 +171,23 @@ function App() {
|
|||||||
Response
|
Response
|
||||||
</Typography>
|
</Typography>
|
||||||
{Object.entries(responseText.result).map(([fileName, fileContent]) => (
|
{Object.entries(responseText.result).map(([fileName, fileContent]) => (
|
||||||
<Box key={fileName} sx={{my: 2}}>
|
<Box key={fileName} sx={{my: 2, p: 2, border: '1px solid #ddd', borderRadius: '4px'}}>
|
||||||
<Typography variant="subtitle1" gutterBottom>
|
<Typography variant="subtitle1" gutterBottom>
|
||||||
{fileName}
|
{fileName}
|
||||||
</Typography>
|
</Typography>
|
||||||
<pre>{fileContent}</pre>
|
<pre>{fileContent}</pre>
|
||||||
|
<Button
|
||||||
|
onClick={() => handleCopy(fileContent)}
|
||||||
|
variant="outlined"
|
||||||
|
color="primary"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
Copy Code
|
||||||
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,10 +7,13 @@ def general_guidelines():
|
|||||||
"General guidelines: "
|
"General guidelines: "
|
||||||
"The code you write is production ready. "
|
"The code you write is production ready. "
|
||||||
"Every file starts with comments describing what the code is doing before the first import. "
|
"Every file starts with comments describing what the code is doing before the first import. "
|
||||||
|
"Comments can only be written between tags. "
|
||||||
"Then all imports are listed. "
|
"Then all imports are listed. "
|
||||||
"It is important to import all modules that could be needed in the executor code. "
|
"It is important to import all modules that could be needed in the executor code. "
|
||||||
"Always import BytesIO from io. "
|
"Always import: "
|
||||||
"Comments can only be written between tags. "
|
"from typing import Dict, List, Optional, Tuple, Union "
|
||||||
|
"from io import BytesIO "
|
||||||
|
"from jina import Executor, DocumentArray, Document, requests "
|
||||||
"Start from top-level and then fully implement all methods. "
|
"Start from top-level and then fully implement all methods. "
|
||||||
"\n"
|
"\n"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user