Skip to content

Commit

Permalink
Merge pull request #95 from kounkou/bring-perfection-to-switchDelegate
Browse files Browse the repository at this point in the history
(chore) bring perfection to switch delegate
  • Loading branch information
kounkou authored Nov 3, 2024
2 parents d72fd58 + b0f99ee commit 68034cc
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 24 deletions.
3 changes: 2 additions & 1 deletion logic/mathematics/sieve.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ var question = [
}
for (int i = 2; i <= n; i++) {
if (isPrime[i])
if (isPrime[i]) {
cout << i << " ";
}
}
}`,
answerGo: `package main
Expand Down
20 changes: 15 additions & 5 deletions qml/PracticePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,20 @@ Rectangle {
}

function submitPrompt(prompt) {
var url = "https://api-inference.huggingface.co/models/llama-3.1-Nemotron-70b-instruct";
var url = "https://api.openai.com/v1/chat/completions";
var jsonData = {
"inputs": prompt
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are an expert code reviewer. Provide constructive feedback and suggestions for improvement."
},
{
"role": "user",
"content": "Here is the code snippet for feedback:\n" + prompt
}
],
"temperature": 0.7
};

var xhr = new XMLHttpRequest();
Expand All @@ -189,7 +200,7 @@ Rectangle {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
var response = JSON.parse(xhr.responseText);
root.aiComment = response[0].generated_text;
root.aiComment = response.choices[0].message.content;
} else {
console.log("Error: ", xhr.statusText);
}
Expand All @@ -205,8 +216,7 @@ Rectangle {

root.submittedAnswer = userAnswer

var prompt = "\nWhat is a brief difference between \n\n ```\n" + expectedAnswer + "\n```\n\n and \n\n```\n" + userAnswer + "\n```"
submitPrompt(prompt);
submitPrompt(userAnswer);

sessionObject.attempted += 1

Expand Down
33 changes: 21 additions & 12 deletions qml/SettingsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,26 @@ Rectangle {
indicator: Rectangle {
implicitWidth: 50
implicitHeight: 26
x: control.width - width - control.rightPadding
x: control.width - width - control.rightPadding + 3
y: parent.height / 2 - height / 2
radius: 13
color: control.checked ? themeObject.buttonEasyColor : "#cccccc"
border.color: control.checked ? themeObject.buttonEasyColor : "#cccccc"

Rectangle {
x: control.checked ? parent.width - width : 0
width: 26
height: 26
radius: 13
x: control.checked ? parent.width - width - 3 : 3
width: 22
height: 22
radius: 11
anchors.verticalCenter: parent.verticalCenter
color: control.down ? "#cccccc" : "#ffffff"
border.color: control.checked ? (control.down ? themeObject.buttonEasyColor : "#21be2b") : "#999999"

Behavior on x {
NumberAnimation { duration: 200 }
NumberAnimation {
duration: 200
easing.type: Easing.InOutQuad
}
}
}
}
Expand Down Expand Up @@ -207,22 +211,27 @@ Rectangle {
indicator: Rectangle {
implicitWidth: 50
implicitHeight: 26
x: control.width - width - control.rightPadding
x: control.width - width - control.rightPadding + 3
y: parent.height / 2 - height / 2
radius: 13
color: control.checked ? themeObject.buttonEasyColor : "#cccccc"
border.color: control.checked ? themeObject.buttonEasyColor : "#cccccc"
opacity: enabled ? 1.0 : 0.5

Rectangle {
x: control.checked ? parent.width - width : 0
width: 26
height: 26
radius: 13
x: control.checked ? parent.width - width - 3 : 3
width: 22
height: 22
radius: 11
anchors.verticalCenter: parent.verticalCenter
color: control.down ? "#cccccc" : "#ffffff"
border.color: control.checked ? (control.down ? themeObject.buttonEasyColor : "#21be2b") : "#999999"

Behavior on x {
NumberAnimation { duration: 200 }
NumberAnimation {
duration: 200
easing.type: Easing.InOutQuad
}
}
}
}
Expand Down
16 changes: 10 additions & 6 deletions qml/WelcomePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,27 @@ Rectangle {
indicator: Rectangle {
implicitWidth: 50
implicitHeight: 26
x: themeToggle.width - width - themeToggle.rightPadding
x: themeToggle.width - width - themeToggle.rightPadding + 3
y: parent.height / 2 - height / 2
radius: 13
color: themeToggle.checked ? themeObject.buttonEasyColor : "#cccccc"
border.color: themeToggle.checked ? themeObject.buttonEasyColor : "#cccccc"
opacity: enabled ? 1.0 : 0.5

Rectangle {
x: themeToggle.checked ? parent.width - width : 0
width: 26
height: 26
radius: 13
x: themeToggle.checked ? parent.width - width - 3 : 3
width: 22
height: 22
radius: 11
anchors.verticalCenter: parent.verticalCenter
color: themeToggle.down ? "#cccccc" : "#ffffff"
border.color: themeToggle.checked ? (themeToggle.down ? themeObject.buttonEasyColor : "#21be2b") : "#999999"

Behavior on x {
NumberAnimation { duration: 200 }
NumberAnimation {
duration: 200
easing.type: Easing.InOutQuad
}
}
}
}
Expand Down

0 comments on commit 68034cc

Please sign in to comment.