Skip to content

Commit

Permalink
Split RAG and RaaG
Browse files Browse the repository at this point in the history
  • Loading branch information
amengus87 committed Jun 6, 2024
1 parent e3f5dd1 commit 35bef75
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 30 deletions.
7 changes: 4 additions & 3 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ application {
}

openApi {
groupedApiMappings.set(['http://localhost:1985/api/docs/backendapi': 'swagger-backendapi.json',
'http://localhost:1985/api/docs/publicapi': 'swagger-publicapi.json',
'http://localhost:1985/api/docs/ragapi': 'swagger-ragapi.json'])
groupedApiMappings.set(['http://localhost:1985/api/docs/backend': 'swagger-backend.json',
'http://localhost:1985/api/docs/app': 'swagger-app.json',
'http://localhost:1985/api/docs/rag': 'swagger-rag.json',
'http://localhost:1985/api/docs/raag': 'swagger-raag.json'])
outputDir.set(file("$buildDir/docs"))
waitTimeInSeconds.set(10)
customBootRun {
Expand Down
26 changes: 17 additions & 9 deletions backend/src/main/java/ai/dragon/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,34 @@
@Configuration
public class SwaggerConfig {
@Bean
public GroupedOpenApi publicApi() {
public GroupedOpenApi app() {
return GroupedOpenApi.builder()
.group("publicapi")
.pathsToMatch("/api/publicapi/**")
.group("app")
.pathsToMatch("/api/app/**")
.build();
}

@Bean
public GroupedOpenApi backendApi() {
public GroupedOpenApi backend() {
return GroupedOpenApi.builder()
.group("backendapi")
.pathsToMatch("/api/backendapi/**")
.group("backend")
.pathsToMatch("/api/backend/**")
.build();
}

@Bean
public GroupedOpenApi ragApi() {
public GroupedOpenApi rag() {
return GroupedOpenApi.builder()
.group("ragapi")
.pathsToMatch("/api/ragapi/**")
.group("rag")
.pathsToMatch("/api/rag/**")
.build();
}

@Bean
public GroupedOpenApi raag() {
return GroupedOpenApi.builder()
.group("raag")
.pathsToMatch("/api/raag/**")
.build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.dragon.controller.api.publicapi;
package ai.dragon.controller.api.app;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -9,7 +9,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
@RequestMapping("/api/publicapi/health")
@RequestMapping("/api/app/health")
@Tag(name = "Health", description = "Health Check API Endpoints")
public class HealthOpenApiController {
@GetMapping("/status")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.dragon.controller.api.backendapi.command;
package ai.dragon.controller.api.backend.command;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
Expand All @@ -12,7 +12,7 @@
import jakarta.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/api/backendapi/command/database")
@RequestMapping("/api/backend/command/database")
@Tag(name = "Database Command", description = "Database Command API Endpoints")
public class DatabaseCommandBackendApiController {
@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.dragon.controller.api.backendapi.command;
package ai.dragon.controller.api.backend.command;

import java.util.UUID;

Expand All @@ -15,7 +15,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
@RequestMapping("/api/backendapi/command/silo")
@RequestMapping("/api/backend/command/silo")
@Tag(name = "Silo Command", description = "Silo Command API Endpoints")
public class SiloCommandBackendApiController {
@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.dragon.controller.api.backendapi.repository;
package ai.dragon.controller.api.backend.repository;

import java.lang.reflect.Constructor;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.dragon.controller.api.backendapi.repository;
package ai.dragon.controller.api.backend.repository;

import java.util.List;
import java.util.Map;
Expand All @@ -24,7 +24,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
@RequestMapping("/api/backendapi/repository/farm")
@RequestMapping("/api/backend/repository/farm")
@Tag(name = "Farm Repository", description = "Farm Repository Management API Endpoints")
public class FarmBackendApiController extends AbstractCrudBackendApiController<FarmEntity> {
@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.dragon.controller.api.backendapi.repository;
package ai.dragon.controller.api.backend.repository;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -26,7 +26,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
@RequestMapping("/api/backendapi/repository/silo")
@RequestMapping("/api/backend/repository/silo")
@Tag(name = "Silo Repository", description = "Silo Repository Management API Endpoints")
public class SiloBackendApiController extends AbstractCrudBackendApiController<SiloEntity> {
@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.dragon.controller.api.ragapi;
package ai.dragon.controller.api.raag;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -24,7 +24,7 @@
import jakarta.validation.Valid;

@RestController
@RequestMapping("/api/ragapi/v1")
@RequestMapping("/api/raag/v1")
@Tag(name = "Open AI Compatible", description = "Compatible Endpoints following Open AI API Format")
public class OpenAiCompatibleV1ApiController {
@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.dragon.controller.api.ragapi;
package ai.dragon.controller.api.rag;

import java.util.List;
import java.util.UUID;
Expand All @@ -22,7 +22,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
@RequestMapping("/api/ragapi/search")
@RequestMapping("/api/rag/search")
@Tag(name = "Ask", description = "Search API Endpoints")
public class SearchRagApiController {
@Autowired
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/commands/database-export.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ docker run -v /path/to/output:/output dragon --command=database-export --output=
## Online Export
To export the database while the backend server is running, use the following API endpoint:
```bash
curl -X 'POST' 'http://localhost:1985/api/backendapi/command/database/database/export'
curl -X 'POST' 'http://localhost:1985/api/backend/command/database/database/export'
```
3 changes: 1 addition & 2 deletions docs/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ Let's discover **dRAGon in less than 5 minutes**.

### Docker
```shell
docker pull ghcr.io/dragon-okinawa/dragon:latest
docker run -d -p 1985:1985 -v $(pwd)/data:/data --name dragon ghcr.io/dragon-okinawa/dragon:latest
docker run --rm -p 1985:1985 -v $(pwd)/data:/data --name dragon ghcr.io/dragon-okinawa/dragon:latest
```

### Gradle
Expand Down

0 comments on commit 35bef75

Please sign in to comment.