diff --git a/css/home.css b/css/home.css index 6451b5f..43f8fba 100644 --- a/css/home.css +++ b/css/home.css @@ -43,8 +43,16 @@ margin-top: 1.5rem; overflow-y: scroll; height: 300px; + background-color: #282c34; /* Dark background */ + color: #ffffff; /* Light text color */ + font-family: 'Courier New', Courier, monospace; /* Monospace font */ + padding: 1rem; /* Padding for spacing */ + border: 1px solid #444; /* Optional border for definition */ + border-radius: 5px; /* Optional rounded corners */ + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); /* Optional shadow for depth */ } + #title { margin-top: 0; } @@ -148,4 +156,4 @@ for mobile responsiveness */ height: auto; } - \ No newline at end of file + diff --git a/index.html b/index.html index 9947517..bc02e67 100644 --- a/index.html +++ b/index.html @@ -4,27 +4,27 @@ - AiProf + AICoder + content="Unlock the future of learning with AICoder. Elevate your educational experience and discover how AI is reshaping the way you learn and teach" /> + content="Ai, free learning, Artificial Intelligence, education, AI Coder, Meet Your AI, teaching, free lessons, math, history, sports"> - - - - + + + + + content="Unlock the future of learning with AICoder. Elevate your educational experience and discover how AI is reshaping the way you learn and teach"> - + - + content="Unlock the future of learning with AICoder. Elevate your educational experience and discover how AI is reshaping the way you learn and teach" /> + @@ -97,7 +97,7 @@ + href="https://getsomesleepbro.github.io/AICoder/blog/BlogIndex">Blog @@ -125,7 +125,7 @@
-

Ai Prof The Most
Helpful TeacherAI Coder The Most
Helpful Teacher @@ -291,7 +291,7 @@

Our Services

@@ -380,7 +380,7 @@

Increased Productivity

- About AIProf @@ -509,7 +509,7 @@

Our Progress so far

How To Use AIProf + class='featured-text'>AICoder Book Your Teacher With A Group

04.
-
Book Your Own AiProf
+
Book Your Own AICoder
@@ -803,13 +803,13 @@

+ AI Coder free?

- We offer a free version with the Meet Your AI Prof chatbot for quick answers, + We offer a free version with the Meet Your AI Coder chatbot for quick answers, along with two subscription plans for personalized solutions that cater to your specific needs.

@@ -840,14 +840,14 @@
+ Is AICoder for Charity?

- Yes, AiProf also operates as a charity, + Yes, AICoder also operates as a charity, dedicated to providing free educational resources and support to students.

@@ -858,13 +858,13 @@
+ AICoder Safe?
-

AIProf is committed to data security, employing stringent measures to safeguard +

AICoder is committed to data security, employing stringent measures to safeguard your personal and business information, guaranteeing its protection.

@@ -899,7 +899,7 @@
email:
@@ -945,7 +945,7 @@
Partners:
@@ -977,14 +977,14 @@
Influencers:
Home
@@ -993,18 +993,18 @@
Influencers:
@@ -1027,7 +1027,7 @@
  • diff --git a/js/askMe.js b/js/askMe.js index eea4ef1..f3351ff 100644 --- a/js/askMe.js +++ b/js/askMe.js @@ -10,52 +10,65 @@ document.addEventListener("DOMContentLoaded", () => { let access_token = null; let refresh_token = null; responseDiv.style.display = "none"; + const handleAsk = () => { const question = questionInput.value; - questionInput.innerHTML = " " + questionInput.innerHTML = " "; if (question) { - askButton.innerHTML = 'Loading'; - setResponse('Please wait! Response is coming....') - setIsLoading(true) + askButton.innerHTML = 'Loading'; + setResponse('Please wait! Response is coming....'); + setIsLoading(true); - // if (access_token) { - const headers = { - 'Content-Type': 'application/json', - // 'Authorization': `Bearer ${access_token}`, - }; - const api_url = "https://awesome-terra-400014.lm.r.appspot.com/chat/"; - const data = { "user_input": question }; - - fetch(api_url, { - method: "POST", - headers: headers, - body: JSON.stringify(data), - }) - .then((response) => { - if (response.status === 401) { - refreshAccessToken(refresh_token, makeApiRequest); - } else { - console.log("I'm not in response mode", response); - return response.json(); - } - }) - .then((result) => { - forVoice = result.chatbot_response; - const ans = result.chatbot_response; - setResponse(ans); - setIsLoading(false) - // toogle() - }) - .catch((error) => { - responseDiv.textContent = "Request failed with an error."; - setIsLoading(false) - setResponse('Something went wrong. Please try again') - }); - // } else { - // setIsLoading(false) - // setResponse('No access token found.') - // } - }}; + // OpenAI API integration + const apiKey = prompt("Please enter your OpenAI API key:"); + if (!apiKey) { + alert("API key is required to proceed."); + return; + } + console.log(apiKey); + + const headers = { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${apiKey}` + }; + + const data = { + model: "gpt-4", + messages: [ + { role: "system", content: "You are the best coder, writing clean, efficient code in a user-friendly manner. Write only code and avoid providing extra text. Include comments wherever necessary to explain key steps and logic." }, + { role: "user", content: "just output the code and don't output any support text at start or end, just the code without '```' at start and end; now the question is -> "+question } + ] + }; + + const api_url = "https://api.openai.com/v1/chat/completions"; + + console.log(api_url, data, headers); + + fetch(api_url, { + method: "POST", + headers: headers, + body: JSON.stringify(data), + }) + .then((response) => { + if (response.ok) { + return response.json(); + } else { + throw new Error("Request failed!"); + } + }) + .then((result) => { + const ans = result.choices[0].message.content; // Extract OpenAI's response + forVoice = ans; + setResponse(ans); + setIsLoading(false); + }) + .catch((error) => { + responseDiv.textContent = "Request failed with an error."; + setIsLoading(false); + setResponse('Something went wrong. Please try again'); + }); + } + }; // const refreshAccessToken = (refreshToken, onSuccess) => { // console.log('Refresh token') @@ -294,4 +307,4 @@ const toogle = () => { } } speaker.addEventListener('click', toogle) -}); \ No newline at end of file +});