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: New Setting UI. #955

Merged
merged 5 commits into from
Jan 14, 2025
Merged

feat: New Setting UI. #955

merged 5 commits into from
Jan 14, 2025

Conversation

Emt-lin
Copy link
Contributor

@Emt-lin Emt-lin commented Dec 20, 2024

New Setting UI.

I tested some popular themes. It's work well in light/dark mode.

CleanShot 2025-01-10 at 18 51 20

@logancyang
Copy link
Owner

Tailwind PR is merged! This one can rebase master now.

@zeroliu
Copy link
Collaborator

zeroliu commented Jan 5, 2025

Thanks for integrating with the latest tokens! Before I dive into the implementation, I have a few pieces of feedback on the UI

  1. Can we add a border to the slider control? It's hard to see in the following example
Screenshot 2025-01-05 at 1 14 59 PM
  1. Can we use a neutral color for a switch when the value is false? The opaque version makes it look like it's disabled.
Screenshot 2025-01-05 at 1 17 08 PM
  1. Can we make the tabs show text by default? The animation is nice, but it's hard to tell what each tab is about from the tab icon. There are many horizontal rooms for all the tabs to show text by default. The larger tab is also easier to use on mobile.
Screenshot 2025-01-05 at 1 18 05 PM
  1. A list view may be more suitable for API key management. The current UI feels like people can set one API key for one provider at a time. It's also challenging to know what API keys I have set and have to pick providers one at a time to reveal the API keys. Ideally, all the providers with API keys set should show up by default.
Screenshot 2025-01-05 at 1 21 38 PM

I built an alternative version with V0. Please feel free to use it as a reference. https://v0.dev/chat/F2dDiCZXeX2?b=b_1x2gOAr4gtO

image

  1. The border of this table can be removed or should use the highlight color. The gap looks off.
Screenshot 2025-01-05 at 1 32 59 PM
  1. The grouping may benefit from some adjustments
  • The API key management and chat model config can live in the same tab
  • Configs such as "default mode", "default conversation folder name" and configs that are not AI model related can live in the "basic" tab.
  • Everything Embedding-related can have its tab
  1. Can we configure temperature and context length in each AI model? How is it related to the global temperate and context length settings? This doesn't exist in the existing settings.
Screenshot 2025-01-05 at 1 36 59 PM

@logancyang
Copy link
Owner

logancyang commented Jan 6, 2025

@Emt-lin This is a major milestone, very nice and clean! Congrats! Once this gets released I will bump the version to v2.8 🚀 !

+1 for everything @zeroliu said. Here are some of my own initial observations:

  1. Can we move this to the top as Plus will be our first-class citizen and we should highlight it wherever possible. Better to add a CTA button "Get Copilot Plus" that links to our landing page. Also small nit: this question mark doesn't show the tooltip on hover but only with a click.
SCR-20250105-pmis
  1. Is "User System Prompt" missing? I don't see it on any tab.
SCR-20250105-pmbm
  1. This one should be "Chat Model[s]", and echoing @zeroliu 's comment, we don't have per-model param at the moment, so this edit button and modal shouldn't be implemented now
SCR-20250105-pkmd
  1. The provider name can get cutoff
SCR-20250105-pjlo
  1. Since we are removing a lot text explanations from the current settings (which is great), should we add a link to the doc site at the top of the settings?

@Emt-lin Emt-lin force-pushed the UI-3 branch 2 times, most recently from d4a8623 to 0e6efaf Compare January 7, 2025 08:33
@logancyang
Copy link
Owner

logancyang commented Jan 8, 2025

Very close to the finishing line! This is the biggest change we have before the official launch. It would be awesome if we can ship this in less than a week. Thanks for your hard work on this!! @Emt-lin

Some more comments:

  1. Should API be its own section and not in the Chat section? Since both Chat and Embedding models require API keys. We can also add a "?" or something obvious to say "API key required for chat and QA features".
SCR-20250107-pxhl
  1. Add "default" to "chat model" and "embedding model"
  2. If API key has its own section and we add "default" to chat and embedding model, we can remove "Chat" and "Embedding" sections and have "defaults" under "General" section.
  3. Auto index strategy should be in the QA tab (I think we should have QA as a separate tab)
  4. Again, we don't need these edit buttons at the moment
SCR-20250107-pyax
  1. User System Prompt should be in Advanced settings as before
SCR-20250107-pyfa
  1. Everything below this line should be in the QA tab
SCR-20250107-pylp

Just some reorganization, overall looks great and 100x better than what I have now! 👍

@@ -73,6 +73,17 @@ export interface CustomModel {
isBuiltIn?: boolean;
enableCors?: boolean;
core?: boolean;
stream?: boolean;
temperature?: number;
context?: number;
Copy link
Owner

Choose a reason for hiding this comment

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

What is context? I assume you mean maxToken?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is context? I assume you mean maxToken?

yeah, I will remove it in this PR. The next PR will implement the single model edit feature.

Copy link
Owner

Choose a reason for hiding this comment

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

Great, single model parameters is a first step to the "project" feature next. Each project has its own:

  • Model key
  • Model params
  • User system prompt
  • Subset of the index with inclusions filter

@logancyang
Copy link
Owner

@Emt-lin The reorganization looks good! How does mobile settings work with this PR?

I'd like to merge this one asap since we are close to the official launch and we need some more user testing before it. @zeroliu let me know if you have any concerns.

if (!Platform.isMobile) {
sections.render(<SettingsMainV2 plugin={this.plugin} />);
return;
}
Copy link
Owner

Choose a reason for hiding this comment

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

Does this mean mobile is still using the old settings? Do we plan to update mobile too in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this mean mobile is still using the old settings?

yes, maybe some componments will adopt new implementations in mobile devices.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the reason why mobile can't work with the new settings? It will add overhead for us to maintain two versions of settings. I would highly recommend us to keep one version if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zeroliu Model list will continue to use old layout in mobile device.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will remove the old settings.

Comment on lines 15 to 22
useEffect(() => {
// fix
if (!modalContainer) {
const modal = document.querySelector(".modal-container") as HTMLElement;
setModalContainer(modal);
}
}, []);
Copy link
Collaborator

Choose a reason for hiding this comment

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

there is an eslint error here. Also what's the reason for this effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Portal component need container arg. eg: select、dialog、popover

Copy link
Collaborator

@zeroliu zeroliu Jan 10, 2025

Choose a reason for hiding this comment

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

Is there any reason why we need to specify the modal container as the portal container? I suggest using body directly like the current tooltip if possible. Radix uses body by default and because of obsidian special requirement, we need to attach the activeDocument body to it as containers. It will simplify the implementation a lot.

if (!Platform.isMobile) {
sections.render(<SettingsMainV2 plugin={this.plugin} />);
return;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the reason why mobile can't work with the new settings? It will add overhead for us to maintain two versions of settings. I would highly recommend us to keep one version if possible

src/settings/v2/components/ApiKeyDialog.tsx Outdated Show resolved Hide resolved
src/settings/v2/components/ApiKeyDialog.tsx Outdated Show resolved Hide resolved
src/settings/v2/components/ApiKeyDialog.tsx Outdated Show resolved Hide resolved
src/settings/v2/components/BasicSettings.tsx Outdated Show resolved Hide resolved
src/styles/tailwind.css Outdated Show resolved Hide resolved
@Emt-lin Emt-lin force-pushed the UI-3 branch 4 times, most recently from e3409fa to ee2ea06 Compare January 10, 2025 10:50
@Emt-lin
Copy link
Contributor Author

Emt-lin commented Jan 13, 2025

@zeroliu @logancyang Embedding Model title has already modified, but I don't want to modify the implementation of the dialog. If there is a lot of feedback after launching the New setting UI, I will replace the shadcn/ui dialog with native modal .

@logancyang
Copy link
Owner

I think this is lgtm generally.

One potential caveat: we actually do not allow deleting core models at the moment (the code was lost from before), but that's actually a good thing because we allow deleting the "default chat model" with this new UI. Since gpt 4o is the top chat model in our builtin models, deleting a default chat model automatically sets the default to gpt 4o which is not deletable. This is an acceptable behavior now. Just wanted to point it out.

@logancyang
Copy link
Owner

@zeroliu let me know when you think this is ready to merge and I'll merge it.

@logancyang
Copy link
Owner

Merging now. Will follow up with minor updates in the future according to user feedback. Huge congrats @Emt-lin !!! 🚀🚀🚀

@logancyang logancyang merged commit c3e6272 into logancyang:master Jan 14, 2025
2 checks passed
@logancyang logancyang mentioned this pull request Jan 16, 2025
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.

3 participants