Skip to content

Commit

Permalink
[DERCBOT-1249] Get a single dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
assouktim committed Nov 21, 2024
1 parent efa516a commit 1f7e145
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 16 deletions.
2 changes: 2 additions & 0 deletions bot/admin/server/src/main/kotlin/BotAdminService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ object BotAdminService {
}
}

fun getDialog(dialogId: Id<Dialog>): DialogReport? = dialogReportDAO.getDialog(dialogId)

fun getIntentsInDialogs(namespace: String,nlpModel : String) : Set<String>{
return dialogReportDAO.intents(namespace,nlpModel)
}
Expand Down
62 changes: 46 additions & 16 deletions bot/admin/server/src/main/kotlin/BotAdminVerticle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,14 @@ open class BotAdminVerticle : AdminVerticle() {
}
}

blockingJsonGet("/bots/:botId/dialogs/:dialogId", botUser) { context ->
if (front.getApplicationByNamespaceAndName(context.organization, context.path("botId")) != null) {
BotAdminService.getDialog(context.pathId("dialogId"))
} else {
unauthorized()
}
}

blockingJsonGet(
"/dialogs/intents/:applicationId",
setOf(botUser)
Expand Down Expand Up @@ -453,9 +461,14 @@ open class BotAdminVerticle : AdminVerticle() {
}
}

blockingJsonGet("/configuration/bots/:botId/rag", admin) { context ->
RAGService.getRAGConfiguration(context.organization, context.path("botId"))
?.let { BotRAGConfigurationDTO(it) }
blockingJsonGet("/configuration/bots/:botId/rag", admin) { context ->
val botId = context.path("botId")
if (front.getApplicationByNamespaceAndName(context.organization, botId) != null) {
RAGService.getRAGConfiguration(context.organization, botId)
?.let { BotRAGConfigurationDTO(it) }
} else {
unauthorized()
}
}

blockingDelete("/configuration/bots/:botId/rag", admin) { context ->
Expand All @@ -471,10 +484,15 @@ open class BotAdminVerticle : AdminVerticle() {
}

blockingJsonGet("/configuration/bots/:botId/observability", admin) { context ->
ObservabilityService.getObservabilityConfiguration(context.organization, context.path("botId"))
?.let {
BotObservabilityConfigurationDTO(it)
}
val botId = context.path("botId")
if (front.getApplicationByNamespaceAndName(context.organization, botId) != null) {
ObservabilityService.getObservabilityConfiguration(context.organization, botId)
?.let {
BotObservabilityConfigurationDTO(it)
}
} else {
unauthorized()
}
}

blockingDelete("/configuration/bots/:botId/observability", admin) { context ->
Expand All @@ -490,10 +508,15 @@ open class BotAdminVerticle : AdminVerticle() {
}

blockingJsonGet("/configuration/bots/:botId/vector-store", admin) { context ->
VectorStoreService.getVectorStoreConfiguration(context.organization, context.path("botId"))
?.let {
BotVectorStoreConfigurationDTO(it)
}
val botId = context.path("botId")
if (front.getApplicationByNamespaceAndName(context.organization, botId) != null) {
VectorStoreService.getVectorStoreConfiguration(context.organization, botId)
?.let {
BotVectorStoreConfigurationDTO(it)
}
} else {
unauthorized()
}
}

blockingDelete("/configuration/bots/:botId/vector-store", admin) { context ->
Expand Down Expand Up @@ -1110,11 +1133,18 @@ open class BotAdminVerticle : AdminVerticle() {
"/configuration/bots/:botId/sentence-generation/configuration",
admin
) { context ->
SentenceGenerationService.getSentenceGenerationConfiguration(context.organization,
context.path("botId"))
?.let {
BotSentenceGenerationConfigurationDTO(it)
}
val botId = context.path("botId")
if (front.getApplicationByNamespaceAndName(context.organization, botId) != null) {
SentenceGenerationService.getSentenceGenerationConfiguration(
context.organization,
botId
)
?.let {
BotSentenceGenerationConfigurationDTO(it)
}
} else {
unauthorized()
}
}

blockingJsonGet(
Expand Down

0 comments on commit 1f7e145

Please sign in to comment.