-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : convert from get to post endpoint (#27)
* feat : convert from get to post endpoint * rename : project name * add request and response, convert endpoint to post
- Loading branch information
1 parent
4931dae
commit 6adb623
Showing
29 changed files
with
143 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
...ain4j-spring-boot/src/main/java/com/learning/ai/controller/CustomerSupportController.java
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ing/ai/config/AICustomerSupportAgent.java → ...ing/ai/config/AICustomerSupportAgent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...AllMiniLmL6V2-llm/src/main/java/com/learning/ai/controller/CustomerSupportController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.learning.ai.controller; | ||
|
||
import com.learning.ai.config.AICustomerSupportAgent; | ||
import com.learning.ai.domain.request.AIChatRequest; | ||
import com.learning.ai.domain.response.AICustomerSupportResponse; | ||
import jakarta.validation.Valid; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api/ai") | ||
@Validated | ||
public class CustomerSupportController { | ||
|
||
private final AICustomerSupportAgent aiCustomerSupportAgent; | ||
|
||
public CustomerSupportController(AICustomerSupportAgent aiCustomerSupportAgent) { | ||
this.aiCustomerSupportAgent = aiCustomerSupportAgent; | ||
} | ||
|
||
@PostMapping("/chat") | ||
public AICustomerSupportResponse customerSupportChat(@RequestBody @Valid AIChatRequest aiChatRequest) { | ||
return aiCustomerSupportAgent.chat(aiChatRequest.question()); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...chain4j-AllMiniLmL6V2-llm/src/main/java/com/learning/ai/domain/request/AIChatRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.learning.ai.domain.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Pattern; | ||
import jakarta.validation.constraints.Size; | ||
import java.io.Serializable; | ||
|
||
public record AIChatRequest( | ||
@NotBlank(message = "Query cannot be empty") | ||
@Size(max = 800, message = "Query exceeds maximum length") | ||
@Pattern(regexp = "^[a-zA-Z0-9 ?]*$", message = "Invalid characters in query") | ||
String question) | ||
implements Serializable {} |
2 changes: 1 addition & 1 deletion
2
.../ai/domain/AICustomerSupportResponse.java → ...n/response/AICustomerSupportResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package com.learning.ai.domain; | ||
package com.learning.ai.domain.response; | ||
|
||
public record AICustomerSupportResponse(String response) {} |
2 changes: 2 additions & 0 deletions
2
...src/main/resources/application.properties → ...src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...nai-llm/src/main/java/com/learning/ai/llmragwithspringai/model/request/AIChatRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.learning.ai.llmragwithspringai.model.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Pattern; | ||
import jakarta.validation.constraints.Size; | ||
import java.io.Serializable; | ||
|
||
public record AIChatRequest( | ||
@NotBlank(message = "Query cannot be empty") | ||
@Size(max = 800, message = "Query exceeds maximum length") | ||
@Pattern(regexp = "^[a-zA-Z0-9 ?]*$", message = "Invalid characters in query") | ||
String question) | ||
implements Serializable {} |
5 changes: 5 additions & 0 deletions
5
...i-llm/src/main/java/com/learning/ai/llmragwithspringai/model/response/AIChatResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.learning.ai.llmragwithspringai.model.response; | ||
|
||
import java.io.Serializable; | ||
|
||
public record AIChatResponse(String response) implements Serializable {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.