Skip to content

Commit

Permalink
Add backend and frontend
Browse files Browse the repository at this point in the history
- Set up /gpt endpoint on backend that
    allows to use the OpenAI API
- Created simple frontend for chat with
    user's and bot's answers
  • Loading branch information
friezzerr committed May 19, 2024
1 parent b530eca commit 7e96fa9
Show file tree
Hide file tree
Showing 20 changed files with 4,925 additions and 19 deletions.
10 changes: 10 additions & 0 deletions project_9/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Gradle
.gradle
gradle/
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

# VS Code
.vscode/
38 changes: 38 additions & 0 deletions project_9/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project

plugins {
kotlin("jvm") version "1.8.20"
id("io.ktor.plugin") version "2.2.4"
id("org.jetbrains.kotlin.plugin.serialization") version "1.8.20"
}

group = "com.project_9"
version = "0.0.1"
application {
mainClass.set("com.project_9.ApplicationKt")

val isDevelopment: Boolean = project.ext.has("development")
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}

repositories {
mavenCentral()
}

dependencies {
implementation("io.ktor:ktor-server-core-jvm:$ktor_version")
implementation("io.ktor:ktor-server-content-negotiation:$ktor_version")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
implementation("io.ktor:ktor-serialization-jackson:$ktor_version")
implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktor_version")
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:$ktor_version")
implementation("io.ktor:ktor-server-netty-jvm:$ktor_version")
implementation("ch.qos.logback:logback-classic:$logback_version")
implementation("io.ktor:ktor-server-cors:$ktor_version")
implementation("dev.kord:kord-core:0.8.2")
implementation ("com.aallam.openai:openai-client:3.2.5")
testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
}
24 changes: 24 additions & 0 deletions project_9/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions project_9/frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GPT Chat Bot</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading

0 comments on commit 7e96fa9

Please sign in to comment.