Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
pse-trapp-public
IntentFinder
Commits
d597fc1d
Commit
d597fc1d
authored
Jun 08, 2021
by
Chiraz Boukadida
Browse files
[fix,
#31
] with docker upload docx file
parent
0e711893
Pipeline
#73987
passed with stages
in 2 minutes and 36 seconds
Changes
9
Pipelines
1
Show whitespace changes
Inline
Side-by-side
PM/Team1/sprints.md
View file @
d597fc1d
**
1. Sprint: 28.4. - 12.5
**
##
1. Sprint: 28.4. - 12.5
**Sprintziel:**
Extrahierung einzelner Fragen und dazugehörigen Antworten von unterschiedlichen Medien.
Persistierung der ausgelesenen Daten.
#27 Definition guter Testfälle und Beispiele (FAQ, ...)
#41 Spike: Fragengenerierung
#25 Recherche/Definition Endpoints
#26 Chatbot-Vokabeln
#32 Definition einer sinnvollen JSON-Konfiguration mit konkreten Beispielen
#33 Abbildung der JSON-Konfiguration in eine geeignete Kotlin-Datenstruktur und Implementation des zugehörigen Endpoints
#30 Implementation Endpoint Hochladen einer DOCX-Datei
#31 Implementation Endpoint Hochladen einer DOCX-FAQ-Datei mit Änderungen
#34 Definition einer MongoDB-Struktur
#36 Methoden zum Lesen, Schreiben und Ändern der MongoDB
#38 Extraction von Fragen und Antworten einer HTML-FAQ-Datei auf Basis einer Konfiguration
#37 Extraction von Fragen und Antworten einer DOCX-FAQ-Datei auf Basis einer Konfiguration
#39 Daten in die MongoDB schreiben und Zusammenfassung einbinden
#28 Überarbeitung ID-Generierung
#40 Einlesen und Parsen einer HTML-Seite mit JSOUP, Zerlegen in semantische Blöcke
*
\
#
27 Definition guter Testfälle und Beispiele (FAQ, ...)
*
\
#
41 Spike: Fragengenerierung
*
\
#
25 Recherche/Definition Endpoints
*
\
#
26 Chatbot-Vokabeln
*
\
#
32 Definition einer sinnvollen JSON-Konfiguration mit konkreten Beispielen
*
\
#
33 Abbildung der JSON-Konfiguration in eine geeignete Kotlin-Datenstruktur und Implementation des zugehörigen Endpoints
*
\
#
30 Implementation Endpoint Hochladen einer DOCX-Datei
*
\
#
31 Implementation Endpoint Hochladen einer DOCX-FAQ-Datei mit Änderungen
*
\
#
34 Definition einer MongoDB-Struktur
*
\
#
36 Methoden zum Lesen, Schreiben und Ändern der MongoDB
*
\
#
38 Extraction von Fragen und Antworten einer HTML-FAQ-Datei auf Basis einer Konfiguration
*
\
#
37 Extraction von Fragen und Antworten einer DOCX-FAQ-Datei auf Basis einer Konfiguration
*
\
#
39 Daten in die MongoDB schreiben und Zusammenfassung einbinden
*
\
#
28 Überarbeitung ID-Generierung
*
\
#
40 Einlesen und Parsen einer HTML-Seite mit JSOUP, Zerlegen in semantische Blöcke
**
2. Sprint: 12.5. - 9.6
**
##
2. Sprint: 12.5. - 9.6
**Sprintziel:**
Extrahierung einzelner Fragen und dazugehörigen Antworten von unterschiedlichen Medien.
Fragemöglichkeit generieren. Persistierung der ausgelesenen Daten.
#27 Definition guter Testfälle und Beispiele (FAQ, ...)
#41 Spike: Fragengenerierung
#25 Recherche/Definition Endpoints
#26 Chatbot-Vokabeln
#33 Abbildung der JSON-Konfiguration in eine geeignete Kotlin-Datenstruktur und Implementation des zugehörigen Endpoints
#30 Implementation Endpoint Hochladen einer DOCX-Datei
#31 Implementation Endpoint Hochladen einer DOCX-FAQ-Datei mit Änderungen
#34 Definition einer MongoDB-Struktur
#36 Methoden zum Lesen, Schreiben und Ändern der MongoDB
#38 Extraction von Fragen und Antworten einer HTML-FAQ-Datei auf Basis einer Konfiguration
#37 Extraction von Fragen und Antworten einer DOCX-FAQ-Datei auf Basis einer Konfiguration
#39 Daten in die MongoDB schreiben und Zusammenfassung einbinden
#28 Überarbeitung ID-Generierung
#40 Einlesen und Parsen einer HTML-Seite mit JSOUP, Zerlegen in semantische Blöcke
#43 Question Generator
#55 Fragemöglichkeit mit Chatette generieren
#56 Fragemöglichkeit mit Bibliothek Question Generator generieren
*
\
#
27 Definition guter Testfälle und Beispiele (FAQ, ...)
*
\
#
41 Spike: Fragengenerierung
*
\
#
25 Recherche/Definition Endpoints
*
\
#
26 Chatbot-Vokabeln
*
\
#
33 Abbildung der JSON-Konfiguration in eine geeignete Kotlin-Datenstruktur und Implementation des zugehörigen Endpoints
*
\
#
30 Implementation Endpoint Hochladen einer DOCX-Datei
*
\
#
31 Implementation Endpoint Hochladen einer DOCX-FAQ-Datei mit Änderungen
*
\
#
34 Definition einer MongoDB-Struktur
*
\
#
36 Methoden zum Lesen, Schreiben und Ändern der MongoDB
*
\
#
38 Extraction von Fragen und Antworten einer HTML-FAQ-Datei auf Basis einer Konfiguration
*
\
#
37 Extraction von Fragen und Antworten einer DOCX-FAQ-Datei auf Basis einer Konfiguration
*
\
#
39 Daten in die MongoDB schreiben und Zusammenfassung einbinden
*
\
#
28 Überarbeitung ID-Generierung
*
\
#
40 Einlesen und Parsen einer HTML-Seite mit JSOUP, Zerlegen in semantische Blöcke
*
\
#
43 Question Generator
*
\
#
55 Fragemöglichkeit mit Chatette generieren
*
\
#
56 Fragemöglichkeit mit Bibliothek Question Generator generieren
**3. Sprint: 9.6. - 7.7**
src/docker-compose.yaml
View file @
d597fc1d
...
...
@@ -11,6 +11,8 @@ services:
build
:
ktor-server
ports
:
-
8080:8080
volumes
:
-
./ktor-server/uploads:/home/gradle/src/build/install/ktor-server/bin/uploads
openapi_validator
:
build
:
docker-openapi-validator
...
...
src/ktor-server/Dockerfile
View file @
d597fc1d
...
...
@@ -4,5 +4,6 @@ WORKDIR /home/gradle/src
RUN
gradle clean installDist
--no-daemon
EXPOSE
8080
WORKDIR
/home/gradle/src/build/install/ktor-server/bin
RUN
mkdir
-p
/home/gradle/src/build/install/ktor-server/bin/uploads
CMD
./ktor-server
src/ktor-server/src/main/kotlin/de/h_da/fbi/smebt/intentfinder/server/Application.kt
View file @
d597fc1d
package
de.h_da.fbi.smebt.intentfinder.server
import
de.h_da.fbi.smebt.intentfinder.server.nlp.PythonBridge
import
de.h_da.fbi.smebt.intentfinder.server.upload.registerApiRoutes
import
io.ktor.application.*
import
io.ktor.features.*
...
...
@@ -21,8 +22,8 @@ import java.text.SimpleDateFormat
import
java.util.*
import
io.ktor.http.content.*
@Serializable
data class
FileStatus
(
val
path
:
String
,
val
status
:
String
)
//
@Serializable
//
data class FileStatus(val path: String, val status: String)
...
...
@@ -53,96 +54,8 @@ fun Application.module(testing: Boolean = false) {
get
(
"/"
)
{
call
.
respondText
(
"IntentFinder is available"
)
}
// Definition eines Endpunkts zum Hochladen einer DOCX-Datei
post
(
"/{chatbotId}/file"
)
{
var
fileDescription
=
""
var
fileName
=
""
var
status
=
"error"
val
multipartData
=
call
.
receiveMultipart
()
val
pathFile
=
call
.
parameters
[
"chatbotId"
].
toString
()
val
pathAsFile
=
File
(
"uploads/$pathFile"
)
if
(!
Files
.
exists
(
Paths
.
get
(
pathFile
)))
{
pathAsFile
.
mkdir
()
}
multipartData
.
forEachPart
{
part
->
when
(
part
)
{
is
PartData
.
FormItem
->
{
fileDescription
=
part
.
value
}
is
PartData
.
FileItem
->
{
fileName
=
part
.
originalFileName
as
String
var
fileBytes
=
part
.
streamProvider
().
readBytes
()
val
file
=
File
(
"uploads/$pathFile/$fileName"
)
if
(!
file
.
exists
())
{
file
.
createNewFile
()
file
.
writeBytes
(
fileBytes
)
status
=
"created"
}
else
{
call
.
respond
(
HttpStatusCode
.
InternalServerError
,
"file alredy exist"
)
}
}
}
}
call
.
respond
(
FileStatus
(
path
=
"'uploads/$pathFile/$fileName'"
,
status
=
"$status"
))
}
// Definition endpoint zur Änderung eine bereits existierende docx
put
(
"/{chatbotId}/file/{id}/{filename}"
)
{
var
fileDescription
=
""
var
fileName
=
""
var
newName
=
""
val
name
=
call
.
parameters
[
"filename"
].
toString
()
val
pathFile
=
call
.
parameters
[
"chatbotId"
].
toString
()
var
status
=
"error"
val
file
=
File
(
"uploads/$pathFile/$name "
)
val
multipartData
=
call
.
receiveMultipart
()
var
fileContent
=
""
multipartData
.
forEachPart
{
part
->
when
(
part
)
{
is
PartData
.
FormItem
->
{
if
(
part
.
name
.
toString
().
equals
(
"description"
))
{
fileDescription
=
part
.
value
}
if
(
part
.
name
.
toString
().
equals
(
"id"
))
{
var
fileId
=
part
.
value
if
(!
fileId
.
equals
(
call
.
parameters
[
"id"
].
toString
()))
call
.
respond
(
HttpStatusCode
.
NotFound
)
}
}
is
PartData
.
FileItem
->
{
if
(
file
.
exists
())
{
fileName
=
part
.
originalFileName
as
String
val
time
=
System
.
currentTimeMillis
()
val
date
=
Date
(
time
)
val
format
=
SimpleDateFormat
(
"yyMMddHHmm"
)
val
current
=
format
.
format
(
date
)
newName
=
file
.
nameWithoutExtension
+
"_"
+
current
+
"."
+
file
.
extension
var
fileBytes
=
part
.
streamProvider
().
readBytes
()
File
(
"uploads/$pathFile/$newName"
).
writeBytes
(
fileBytes
)
fileContent
=
part
.
streamProvider
().
reader
().
readText
()
status
=
"updated"
}
else
{
call
.
respond
(
HttpStatusCode
.
NotFound
,
"file not found"
)
}
}
}
}
call
.
respond
(
FileStatus
(
path
=
"'uploads/$pathFile/$newName'"
,
status
=
"$status"
))
}
}
registerApiRoutes
()
registerUploadRoutes
()
}
class
InternalServerErrorException
:
RuntimeException
()
...
...
src/ktor-server/src/main/kotlin/de/h_da/fbi/smebt/intentfinder/server/upload/ApiRoutes.kt
0 → 100644
View file @
d597fc1d
package
de.h_da.fbi.smebt.intentfinder.server.upload
import
io.ktor.application.*
import
io.ktor.http.*
import
io.ktor.http.content.*
import
io.ktor.request.*
import
io.ktor.response.*
import
io.ktor.routing.*
import
java.io.File
import
java.nio.file.Files
import
java.nio.file.Paths
import
kotlinx.serialization.Serializable
import
java.text.SimpleDateFormat
import
java.util.*
@Serializable
data class
FileStatus
(
val
path
:
String
,
val
status
:
String
)
fun
Route
.
apiRouting
()
{
route
(
"/"
)
{
post
(
"{chatbotId}/file"
)
{
var
fileDescription
=
""
var
fileName
=
""
var
status
=
"error"
var
path
=
""
val
multipartData
=
call
.
receiveMultipart
()
val
pathFile
=
call
.
parameters
[
"chatbotId"
].
toString
()
val
pathAsFile
=
File
(
"uploads/$pathFile"
)
if
(!
Files
.
exists
(
Paths
.
get
(
pathFile
)))
{
pathAsFile
.
mkdir
()
}
multipartData
.
forEachPart
{
part
->
when
(
part
)
{
is
PartData
.
FormItem
->
{
fileDescription
=
part
.
value
}
is
PartData
.
FileItem
->
{
fileName
=
part
.
originalFileName
as
String
var
fileBytes
=
part
.
streamProvider
().
readBytes
()
val
file
=
File
(
"uploads/$pathFile/$fileName"
)
if
(!
file
.
exists
())
{
file
.
createNewFile
()
file
.
writeBytes
(
fileBytes
)
status
=
"created"
path
=
file
.
path
}
else
{
call
.
respond
(
HttpStatusCode
.
InternalServerError
,
"file alredy exist"
)
}
}
}
}
//'uploads/$pathFile/$fileName'
call
.
respond
(
FileStatus
(
path
=
"$path"
,
status
=
"$status"
))
}
put
(
"{chatbotId}/file/{id}/{filename}"
)
{
var
fileDescription
=
""
var
fileName
=
""
var
newName
=
""
val
name
=
call
.
parameters
[
"filename"
].
toString
()
val
pathFile
=
call
.
parameters
[
"chatbotId"
].
toString
()
var
status
=
"error"
var
file
=
File
(
"uploads/$pathFile/$name"
)
val
multipartData
=
call
.
receiveMultipart
()
var
fileContent
=
""
multipartData
.
forEachPart
{
part
->
when
(
part
)
{
is
PartData
.
FormItem
->
{
if
(
part
.
name
.
toString
().
equals
(
"description"
))
{
fileDescription
=
part
.
value
}
if
(
part
.
name
.
toString
().
equals
(
"id"
))
{
var
fileId
=
part
.
value
if
(!
fileId
.
equals
(
call
.
parameters
[
"id"
].
toString
()))
call
.
respond
(
HttpStatusCode
.
NotFound
)
}
}
is
PartData
.
FileItem
->
{
if
(
file
.
exists
())
{
fileName
=
part
.
originalFileName
as
String
val
time
=
System
.
currentTimeMillis
()
val
date
=
Date
(
time
)
val
format
=
SimpleDateFormat
(
"yyMMddHHmm"
)
val
current
=
format
.
format
(
date
)
newName
=
file
.
nameWithoutExtension
+
"_"
+
current
+
"."
+
file
.
extension
var
fileBytes
=
part
.
streamProvider
().
readBytes
()
File
(
"uploads/$pathFile/$newName"
).
writeBytes
(
fileBytes
)
fileContent
=
part
.
streamProvider
().
reader
().
readText
()
status
=
"updated"
}
else
{
call
.
respond
(
HttpStatusCode
.
NotFound
,
"file not found"
)
}
}
}
}
call
.
respond
(
FileStatus
(
path
=
"'/uploads/$pathFile/$newName'"
,
status
=
"$status"
))
}
}
}
fun
Application
.
registerApiRoutes
()
{
routing
{
apiRouting
()
}
}
src/ktor-server/uploads/1/Dok_2106040947.docx
deleted
100644 → 0
View file @
0e711893
File deleted
src/ktor-server/uploads/Dok.docx
→
src/ktor-server/uploads/
1/
Dok
_2106081352
.docx
View file @
d597fc1d
File moved
src/ktor-server/uploads/Dok1.docx
deleted
100644 → 0
View file @
0e711893
File deleted
src/nlp/requirements.txt
View file @
d597fc1d
...
...
@@ -77,7 +77,7 @@ scipy==1.6.2
protobuf==3.16.0
summarizer~=0.0.7
en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz
sacremoses==0.0.43
sentencepiece==0.1.94
tokenizers==0.9.4
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment