Skip to content

Commit 40aa593

Browse files
Init project
0 parents  commit 40aa593

File tree

230 files changed

+12069
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+12069
-0
lines changed

.github/workflows/build.yaml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Build
2+
3+
on:
4+
push: null
5+
6+
jobs:
7+
build:
8+
name: Build
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
- name: Setup java
14+
uses: actions/setup-java@v4
15+
with:
16+
distribution: 'temurin'
17+
java-version: 17
18+
architecture: x64
19+
- name: Set Gradle User Home
20+
run: export GRADLE_USER_HOME=$(pwd)/.gradle
21+
- name: Cache Gradle Dependencies
22+
uses: actions/cache@v2
23+
with:
24+
path: .gradle/caches
25+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
26+
restore-keys: ${{ runner.os }}-gradle
27+
- name: Cache Gradle Wrapper
28+
uses: actions/cache@v2
29+
with:
30+
path: .gradle/wrapper
31+
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
32+
restore-keys: ${{ runner.os }}-gradle
33+
- name: Gradle build
34+
run: ./gradlew clean build --parallel
35+
prepareDockerImage:
36+
needs: build
37+
name: Prepare docker images
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v2
42+
- name: Setup java
43+
uses: actions/setup-java@v4
44+
with:
45+
distribution: 'temurin'
46+
java-version: 17
47+
architecture: x64
48+
- name: Build Jar
49+
run: ./gradlew bootJar
50+
- name: Build login
51+
run: docker login -u ${{ vars.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }}
52+
- name: Build docker image
53+
run: docker build -t iceknight07/open-chat:latest .
54+
- name: Push docker image
55+
run: docker push iceknight07/open-chat:latest
56+
deploy:
57+
needs: prepareDockerImage
58+
name: Deploy
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Setup SSH connection
62+
run: |
63+
eval $(ssh-agent -s)
64+
mkdir -p ~/.ssh
65+
chmod 700 ~/.ssh
66+
ssh-keyscan ${{ vars.DEPLOY_HOST }} >> ~/.ssh/known_hosts
67+
chmod 644 ~/.ssh/known_hosts
68+
echo "${{ secrets.DEPLOY_KEY }}" | tr -d '\r' > ~/.ssh/private.key
69+
chmod 600 ~/.ssh/private.key
70+
- name: Run command
71+
run: |
72+
ssh -i ~/.ssh/private.key ${{ vars.DEPLOY_USER }}@${{ vars.DEPLOY_HOST }} \
73+
"docker stop open-chat-server || true"
74+
ssh -i ~/.ssh/private.key ${{ vars.DEPLOY_USER }}@${{ vars.DEPLOY_HOST }} \
75+
"docker rm open-chat-server || true"
76+
ssh -i ~/.ssh/private.key ${{ vars.DEPLOY_USER }}@${{ vars.DEPLOY_HOST }} \
77+
"docker rmi iceknight07/open-chat:latest || true"
78+
ssh -i ~/.ssh/private.key ${{ vars.DEPLOY_USER }}@${{ vars.DEPLOY_HOST }} \
79+
"docker run --name open-chat-server --network=open-chat-network -p 443:8443 -d \
80+
-e SPRING_PROFILES_ACTIVE=production \
81+
-e POSTGRES_URL=${{ secrets.POSTGRES_URL }} \
82+
-e POSTGRES_USER=${{ secrets.POSTGRES_USER }} \
83+
-e POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} \
84+
-e KMS_URL=${{ secrets.KMS_URL }} \
85+
-e AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }} \
86+
-e AWS_SECRET_KEY=${{ secrets.AWS_SECRET_KEY }} \
87+
-e AWS_REGION=${{ vars.REGION }} \
88+
-e ATTACHMENTS_BUCKET=${{ vars.ATTACHMENTS_BUCKET }} \
89+
-e RECORDINGS_BUCKET=${{ vars.RECORDINGS_BUCKET }} \
90+
-e TRANSCRIPTS_BUCKET=${{ vars.TRANSCRIPTS_BUCKET }} \
91+
-e COGNITO_USER_POOL_ID=${{ secrets.COGNITO_USER_POOL_ID }} \
92+
-e COGNITO_APP_CLIENT_ID=${{ secrets.COGNITO_APP_CLIENT_ID }} \
93+
-e COGNITO_APP_CLIENT_SECRET=${{ secrets.COGNITO_APP_CLIENT_SECRET }} \
94+
-e JWKS_URL=${{ secrets.JWKS_URL }} \
95+
-e OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \
96+
-e GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }} \
97+
-e FIREBASE_CONFIGURATION_JSON=${{ secrets.FIREBASE_CONFIGURATION_JSON }} \
98+
-e SSL_KEY_STORE_PASSWORD=${{ secrets.SSL_KEY_STORE_PASSWORD }} \
99+
iceknight07/open-chat:latest"

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
HELP.md
2+
.gradle
3+
build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
!**/src/main/**/build/
6+
!**/src/test/**/build/
7+
8+
### STS ###
9+
.apt_generated
10+
.classpath
11+
.factorypath
12+
.project
13+
.settings
14+
.springBeans
15+
.sts4-cache
16+
bin/
17+
!**/src/main/**/bin/
18+
!**/src/test/**/bin/
19+
20+
### IntelliJ IDEA ###
21+
.idea
22+
*.iws
23+
*.iml
24+
*.ipr
25+
out/
26+
!**/src/main/**/out/
27+
!**/src/test/**/out/
28+
29+
### NetBeans ###
30+
/nbproject/private/
31+
/nbbuild/
32+
/dist/
33+
/nbdist/
34+
/.nb-gradle/
35+
36+
### VS Code ###
37+
.vscode/

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM openjdk:17-jdk-slim
2+
EXPOSE 8080
3+
ARG JAR_FILE=build/libs/*.jar
4+
COPY ${JAR_FILE} open-chat.jar
5+
6+
ENTRYPOINT ["java","-jar","/open-chat.jar"]

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# AI Chat Assistant App
2+
3+
Welcome to our AI Chat Assistant App repository! This project aims to create a user-friendly chat application with an AI assistant powered by advanced natural language processing (NLP) techniques. With this app, users can engage in conversations, ask questions, and receive helpful responses from our AI assistant.
4+
5+
## Features
6+
7+
- **Chat Interface**: A sleek and intuitive chat interface where users can type messages and interact with the AI assistant.
8+
- **AI Assistant**: The heart of the application, an AI assistant capable of understanding and responding to user queries.
9+
- **Natural Language Processing (NLP)**: Leveraging state-of-the-art NLP models to understand the nuances of human language and provide accurate responses.
10+
- **Customization**: Users can customize their experience by adjusting settings, preferences, and perhaps even the personality of the AI assistant.
11+
- **Multi-platform**: The app aims to be available on various platforms, including web, mobile, and desktop, ensuring accessibility for users across different devices.
12+
13+
## Technologies Used
14+
15+
16+
## Contributing
17+
18+
We welcome contributions from the community! If you'd like to contribute to this project, please follow these steps:
19+
20+
1. Fork the repository.
21+
2. Create your feature branch (`git checkout -b feature/YourFeature`).
22+
3. Commit your changes (`git commit -am 'Add some feature'`).
23+
4. Push to the branch (`git push origin feature/YourFeature`).
24+
5. Open a pull request.
25+
26+
Please ensure that your pull request follows the repository's code style and guidelines.
27+
28+
## License
29+
30+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
31+
32+
33+
Feel free to customize and expand upon this template to better fit your project's specific details and requirements!

build-docker-image.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VERSION=5.4
2+
docker build --platform linux/amd64 -t iceknight07/open-chat:$VERSION .
3+
docker push iceknight07/open-chat:$VERSION

build.gradle

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
plugins {
2+
id 'java'
3+
id 'org.springframework.boot' version '3.2.3'
4+
id 'io.spring.dependency-management' version '1.1.4'
5+
id 'org.jetbrains.kotlin.jvm' version '2.0.0'
6+
id 'org.jetbrains.kotlin.plugin.spring' version '2.0.0'
7+
}
8+
9+
group = 'io.openfuture'
10+
version = '0.0.1-SNAPSHOT'
11+
12+
java {
13+
sourceCompatibility = '17'
14+
}
15+
16+
configurations {
17+
compileOnly {
18+
extendsFrom annotationProcessor
19+
}
20+
}
21+
22+
repositories {
23+
mavenCentral()
24+
maven {
25+
url "https://maven.dcm4che.org"
26+
}
27+
jcenter()
28+
}
29+
30+
dependencies {
31+
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
32+
implementation 'org.jetbrains.kotlin:kotlin-reflect'
33+
34+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0"
35+
36+
implementation 'io.jsonwebtoken:jjwt:0.12.5'
37+
implementation 'io.jsonwebtoken:jjwt-api:0.12.5'
38+
39+
implementation 'javax.xml.bind:jaxb-api:2.1'
40+
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1'
41+
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1'
42+
43+
runtimeOnly("org.postgresql:postgresql")
44+
implementation 'org.flywaydb:flyway-core:10.10.0'
45+
implementation "org.flywaydb:flyway-database-postgresql:10.10.0"
46+
47+
implementation 'org.springframework.data:spring-data-relational:3.2.3'
48+
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
49+
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
50+
implementation 'org.springframework.boot:spring-boot-starter-security'
51+
implementation 'org.springframework.boot:spring-boot-starter-web'
52+
implementation("org.springframework.boot:spring-boot-starter-validation")
53+
implementation 'org.springframework.boot:spring-boot-starter-websocket'
54+
implementation 'org.springframework.boot:spring-boot-starter-amqp'
55+
implementation 'org.springframework.boot:spring-boot-starter-reactor-netty'
56+
57+
implementation("com.amazonaws:aws-java-sdk-cognitoidp:1.12.681")
58+
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.687'
59+
implementation 'com.amazonaws:aws-java-sdk-transcribe:1.12.761'
60+
implementation 'software.amazon.awssdk:transcribestreaming:2.26.20'
61+
62+
implementation("javax.validation:validation-api:2.0.1.Final")
63+
64+
implementation 'com.amazonaws:aws-java-sdk-qconnect:1.12.693'
65+
66+
implementation 'xuggle:xuggle-xuggler:5.4'
67+
implementation("org.passay:passay:1.6.3")
68+
implementation 'org.kurento:kurento-client:7.1.0'
69+
70+
// WebJars
71+
// WebJars Locator
72+
implementation 'org.webjars:webjars-locator:0.46'
73+
74+
//
75+
implementation ("org.webjars.bower:bootstrap:5.2.2")
76+
implementation ("org.webjars.bower:demo-console:1.5.1")
77+
implementation ("org.webjars.bower:draggabilly:2.1.0")
78+
implementation ("org.webjars.bower:ekko-lightbox:5.2.0")
79+
implementation ("org.webjars.bower:jquery:3.6.1")
80+
implementation ("org.webjars.bower:jsnlog.js:2.20.1")
81+
implementation ("org.webjars.bower:webrtc-adapter:7.4.0")
82+
83+
implementation("org.kurento:kurento-commons:7.1.0")
84+
implementation("org.kurento:kurento-client:7.1.0")
85+
implementation("org.kurento:kurento-utils-js:7.1.0")
86+
87+
compileOnly 'org.projectlombok:lombok'
88+
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
89+
annotationProcessor 'org.projectlombok:lombok'
90+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
91+
testImplementation 'org.springframework.security:spring-security-test'
92+
93+
testImplementation 'org.testcontainers:postgresql:1.19.7'
94+
95+
implementation("org.springframework.boot:spring-boot-starter-webflux")
96+
implementation 'com.google.firebase:firebase-admin:9.2.0'
97+
98+
}
99+
100+
tasks.named('test') {
101+
useJUnitPlatform()
102+
}
103+
104+
compileKotlin {
105+
kotlinOptions {
106+
freeCompilerArgs = ['-Xjsr305=strict']
107+
jvmTarget = '17'
108+
}
109+
}
110+
111+
compileTestKotlin {
112+
kotlinOptions {
113+
freeCompilerArgs = ['-Xjsr305=strict']
114+
jvmTarget = '17'
115+
}
116+
}

database.sql

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
create database open_chat;
2+
use open_chat;
3+
4+
drop table message;
5+
create table message
6+
(
7+
id bigint auto_increment primary key,
8+
body text,
9+
sent_at timestamp,
10+
received_at timestamp,
11+
sender varchar(255),
12+
recipient varchar(255),
13+
content_type varchar(20)
14+
);
15+
16+
create table attachment
17+
(
18+
id int auto_increment primary key,
19+
name varchar(255),
20+
url varchar(255)
21+
);
22+
23+
create table user
24+
(
25+
id int auto_increment primary key,
26+
email varchar(255),
27+
phone_number varchar(255),
28+
registered_at timestamp,
29+
last_login timestamp,
30+
first_name varchar(255),
31+
last_name varchar(255),
32+
avatar varchar(255),
33+
active bool default true
34+
);

deploy.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docker build -t iceknight07/open-chat:1.0 .
2+
docker push iceknight07/open-chat:1.0

docker-compose/docker-compose.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: '3.3'
2+
3+
services:
4+
rabbitmq:
5+
image: rabbitmq:3-management
6+
container_name: rabbitmq
7+
hostname: rabbitmq
8+
ports:
9+
- '5672:5672'
10+
- '15672:15672'
11+
healthcheck:
12+
test: rabbitmqctl node_health_check | grep -q '^Health check passed' || exit 1
13+
volumes:
14+
- rabbitmq-data:/var/lib/rabbitmq
15+
16+
open-chat-postgres:
17+
container_name: open-chat-postgres
18+
hostname: open-chat-postgres
19+
image: postgres
20+
environment:
21+
POSTGRES_DB: open_chat
22+
POSTGRES_USER: postgres
23+
POSTGRES_PASSWORD: 123456
24+
volumes:
25+
- local-postgres-data:/var/lib/postgres
26+
ports:
27+
- "5434:5432"
28+
volumes:
29+
rabbitmq-data:
30+
local-mysql-data:
31+
local-postgres-data:

gradle/wrapper/gradle-wrapper.jar

42.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)