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

Refactored AppSettings.vue to enhance readability and the code structure #12

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

julianbollig
Copy link

No description provided.

Signed-off-by: julianbollig <julian.bollig@tngtech.com>
Signed-off-by: julianbollig <julian.bollig@tngtech.com>
const modelSettingsWatcher = watchEffect(() => {
modelSettings.llm = globalSetup.modelSettings.llm;
modelSettings.sd_model = globalSetup.modelSettings.sd_model;
modelSettings.lora = globalSetup.modelSettings.lora;

Choose a reason for hiding this comment

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

Why do we need the modelSettings carbonCopy here at all? I do not see any usage

});

onMounted(() => {
cancelModelSettingsChange();

Choose a reason for hiding this comment

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

I am also failing to understand, why we need to cancel onMounted and why we would need to activate the watcher. Just from dashing through docs I would assume the way the watcher is used looks like "faulty" to me

cancelModelSettingsChange();
})

onUnmounted(() => {

Choose a reason for hiding this comment

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

in doubt, we should probably use onDecativated / onActivated, which are also called onMounted /onUnmounted, but works around some browser keep-alive cache, see https://vuejs.org/guide/built-ins/keep-alive#lifecycle-of-cached-instance

const globalSetup = useGlobalSetup();

const presetModel = reactive<StringKV>(Object.assign({}, toRaw(globalSetup.presetModel)));
const presetModelChange = ref(false);

Choose a reason for hiding this comment

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

this variable name alones raises confusion about the concept of changing a presetModel.
I however like that you operated the complete logic out of appSettings, leaving AppSettings much cleaner.
It probably would be beneficial, if we operated out the "modelSettingsState" into a dedicated class outside of global state, but given that we have so far questions about how this should be used (and the future of it) we should definetly not do it right now

Signed-off-by: Florian Esser <florian.esser@tngtech.com>
@julianbollig julianbollig merged commit 8f760d5 into dev Dec 4, 2024
5 checks passed
@mschuettlerTNG mschuettlerTNG deleted the RefactorAppSettings branch December 14, 2024 19:38
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