Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update prompt config page (PR 1) #286

Merged
merged 14 commits into from
Jan 11, 2024
Merged

Conversation

Goldziher
Copy link
Member

@Goldziher Goldziher commented Jan 8, 2024

This PR updates the prompt config page by doing the following:

  1. It removes the testing tab and all the existing testing logic (followup PR will add the wizard instead).
  2. It updates the code snippet, making it significantly more complete. The new display has full installation and usage instructions, and it injects the configId and any defined template variables.
  3. It fixes issues with the OpenAI testing that I encountered during development. These could be spinned-out into a separate PR, but they are included.

@Goldziher Goldziher marked this pull request as ready for review January 10, 2024 14:50
@Goldziher Goldziher requested a review from golansoffer January 10, 2024 14:51
@Goldziher Goldziher changed the title feat: redo prompt config page feat: update prompt config display Jan 10, 2024
@Goldziher Goldziher changed the title feat: update prompt config display feat: update prompt config page (PR 1) Jan 10, 2024
Copy link

@golansoffer golansoffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I would suggest extracting some of the code (especially rendering-related/JSX) into a standalone component.

Components shouldn't contain a lot of logic or state (similar to writing functions that follow the Single Responsibility Principle). This will help prevent bugs and quirks in the UI while making maintenance much easier.

Regarding useMemo and memo:

useMemo: Use it to cache "expensive" operations or derived state.
If it's possible to extract logic or expensive calculations into a util file, that's even better:
const [value, setValue] = useState();
const [filterTerm, setFilterTerm] = useState("");
const derivedState = useMemo(() => {
return someUtil(...params);
}, [value, filterTerm]);

// utils.ts
function someUtil(...args): K {
// logic
}

https://frontendmastery.com/posts/building-future-facing-frontend-architectures/

@Goldziher Goldziher merged commit 662c7ae into main Jan 11, 2024
5 of 7 checks passed
@Goldziher Goldziher deleted the redo-prompt-config-page branch January 11, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants