Skip to content

Commit

Permalink
Subject : making corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
paraskuk committed Apr 12, 2024
1 parent 358e55b commit 89b1091
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This application is built using FastAPI for the API and JavaScript ,HTML and CSS
1. Clone the repository
2. Install the required packages using `pip install -r requirements.txt`
3. Set the `OPEN_AI_KEY` environment variable with your OpenAI API key.
4. Setup Redis server on your machine as outlined here https://redis.io/docs/install/install-redis/
4. Setup Redis server on your machine as outlined here https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-windows/


## Usage
Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.8'
services:
app:
build:
context: .
ports:
- "8000:80"
environment:
- OPEN_AI_KEY=${OPEN_AI_KEY}
depends_on:
- redis

redis:
image: redis
ports:
- "6379:6379"
2 changes: 1 addition & 1 deletion models/query_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class GitHubFile(BaseModel):
content: str = Field(..., description="Content of the file")
filename: str = Field(..., description="Filename including extension")
repository: str = Field(default="test-repo-for-app", description="Repository name for github")
username: str = Field(default=None, description="Username of the repository owner in github")
username: str = Field(default="paraskuk", description="Username of the repository owner in github")
message: str
committer: dict

Expand Down
19 changes: 6 additions & 13 deletions templates/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function htmlDecode(input) {
function displayError(message) {
const answerElement = document.getElementById("answer");
answerElement.textContent = message; // Use textContent for security
// If you have an error-specific styling, apply it here

}


Expand Down Expand Up @@ -294,13 +294,13 @@ function startDictation() {

/** Speech Recognition Ends here **/

//github form related function
//GitHub form related function
function saveCodeToGitHub() {
console.log('Save to GitHub button clicked.');

// Existing code for getting the content
const codeContent = btoa(document.getElementById('answer').innerText); // Base64 encode the content to match GitHub's requirement
//btoa(document.getElementById('answer').innerText);

// New code to get additional inputs from the form
const message = document.getElementById('commit-message').value;
const committerName = document.getElementById('committer-name').value;
Expand All @@ -310,9 +310,6 @@ function saveCodeToGitHub() {
// Define the GitHub username, repository, and filename
const username = document.getElementById('username').value; // Username of the GitHub account
const repository = document.getElementById('repository').value; // Repository name
// const username = 'paraskuk'; // Username of the GitHub account
// const repository = 'test-repo-for-app'; // Repository name
//const filename = 'code.py'; // Assume you want to create or update this file

if (!username || !repository || !filename || !message || !committerName || !committerEmail) {
alert('All fields are required.');
Expand All @@ -331,13 +328,6 @@ function saveCodeToGitHub() {
committer: committerName && committerEmail ? { name: committerName, email: committerEmail } : undefined
};

// Optionally include committer details if provided
/* if (committerName && committerEmail) {
payload.committer = {
name: committerName,
email: committerEmail
};
}*/

// Perform the fetch call to the backend
fetch(url, {
Expand Down Expand Up @@ -367,6 +357,9 @@ function saveCodeToGitHub() {






// DOMContentLoaded event listener
document.addEventListener('DOMContentLoaded', function () {
// Attach event listener to the submit button
Expand Down

0 comments on commit 89b1091

Please sign in to comment.