From 2674bc6c20b72e7ba73575a5c1a2e278280ceb71 Mon Sep 17 00:00:00 2001 From: Hazem Krimi Date: Fri, 24 Jan 2025 01:11:10 +0100 Subject: [PATCH] Add todos for next steps --- client/src/App.jsx | 5 +++-- server/main.go | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/App.jsx b/client/src/App.jsx index 0026e01..8a59b55 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -4,7 +4,8 @@ import './App.css'; const KEYS_TO_DISABLE = ['Backspace', 'Shift', 'Alt', 'Control', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'Escape', 'Delete', 'PageDown', 'PageUp', 'Home', 'End', 'Insert', 'WakeUp', 'Pause', 'ScrollLock', 'ContextMenu', 'BrowserForward', 'BrowserBack', 'CapsLock', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight']; function App() { - // TODO: Cleanup the file and create utils for spacing and trimming the code properly. + // TODO: Cleanup the file and create utils for trimming the code properly. + // TODO: Create a function that combines a sequence of spaces into tabs. const [code, setCode] = useState(''); const [loaded, setLoaded] = useState(false); const [characters, setCharacters] = useState([]); @@ -13,7 +14,7 @@ function App() { (async function() { setCode(''); - const response = await fetch(`${import.meta.env.VITE_API_URL}/generate?lang=java&lines=50`); + const response = await fetch(`${import.meta.env.VITE_API_URL}/generate?lang=java&lines=15`); const reader = response.body.getReader(); const decoder = new TextDecoder(); diff --git a/server/main.go b/server/main.go index c176f89..047d18d 100644 --- a/server/main.go +++ b/server/main.go @@ -87,6 +87,7 @@ func main() { ech.Use(middleware.CORS()) ech.GET("/generate", func(ctx echo.Context) error { + // TODO: Make lines an environment variable and tweak it along with the prompt to get a suitable number of lines for the challenge to be fun and not too hard but still challenging. lines, err := strconv.Atoi(ctx.QueryParam("lines")) if err != nil { @@ -112,7 +113,7 @@ func main() { ollamaCtx := context.Background() prompt := []llms.MessageContent{ llms.TextParts(llms.ChatMessageTypeHuman, fmt.Sprintf(` - You must only generate code without any descriptions or code comments and use spaces instead of tabs for spacing. Generate a maximum of %d lines of code from a well known open source project in the %s programming language.`, lines, lang)), + You must only generate code without any text descriptions or code comments and use spaces instead of tabs for spacing. Generate a maximum of %d lines of code from a well known open source project in the %s programming language.`, lines, lang)), } if _, err := llm.GenerateContent(ollamaCtx, prompt, llms.WithStreamingFunc(func(streamCtx context.Context, chunk []byte) error {