Skip to content

Commit 06fbcbf

Browse files
committed
updated the versions and fixed the swagger now you can access the endpoints with http://localhost:7860/swagger-ui/index.html
1 parent 6c1c362 commit 06fbcbf

20 files changed

+330
-142
lines changed

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM openjdk:18
2+
3+
# Set working directory
4+
WORKDIR /ai
5+
6+
# Define the version as a build argument
7+
ARG VERSION=0.0.1
8+
ARG REPO=SpringActions
9+
ARG REPO_OWNER=vishalmysore
10+
11+
# Download the JAR file using curl with the version variable
12+
RUN curl -L -o /ai/mcpdemo.jar https://github.com/${REPO_OWNER}/${REPO}/releases/download/release/${REPO}-${VERSION}.jar
13+
14+
# Expose the port
15+
EXPOSE 7860
16+
17+
# Copy the entrypoint script to the container
18+
COPY entrypoint.sh /entrypoint.sh
19+
20+
# Make the script executable
21+
RUN chmod +x /entrypoint.sh
22+
23+
# Set the entrypoint
24+
ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
ls -l /ai/conf
3+
# Start the Java application
4+
exec java -Dloader.path=/ai/conf -Djava.security.egd=file:/dev/./urandom -jar /ai/easyQServer.jar

pom.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,19 @@
4141
<dependency>
4242
<groupId>io.github.vishalmysore</groupId>
4343
<artifactId>a2ajava</artifactId>
44-
<version>0.0.7.12</version>
44+
<version>0.1.8.1</version>
45+
</dependency>
46+
<dependency>
47+
<groupId>io.github.vishalmysore</groupId>
48+
<artifactId>tools4ai-annotations</artifactId>
49+
<version>0.0.1</version>
4550
</dependency>
46-
4751

4852

4953
<dependency>
5054
<groupId>io.github.vishalmysore</groupId>
5155
<artifactId>tools4ai</artifactId>
52-
<version>1.0.8.1</version>
56+
<version>1.1.4</version>
5357
<exclusions>
5458
<!-- Common Swagger/OpenAPI dependencies to exclude -->
5559
<exclusion>

src/main/java/io/github/vishalmysore/Application.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package io.github.vishalmysore;
22

33

4+
import io.github.vishalmysore.tools4ai.EnableAgent;
45
import org.springframework.boot.SpringApplication;
56
import org.springframework.boot.autoconfigure.SpringBootApplication;
67

78
@SpringBootApplication
9+
@EnableAgent
810
public class Application {
911

1012
public static void main(String[] args) {

src/main/java/io/github/vishalmysore/MCPController.java

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/main/java/io/github/vishalmysore/MyA2ACardController.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/main/java/io/github/vishalmysore/MyA2ATaskController.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/main/java/io/github/vishalmysore/MyRpCController.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/main/java/io/github/vishalmysore/service/CompareCarService.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import com.t4a.detect.ActionCallback;
99
import com.t4a.detect.ActionState;
10+
import com.t4a.processor.AIProcessor;
1011
import io.github.vishalmysore.a2a.domain.Task;
1112
import io.github.vishalmysore.a2a.domain.TaskState;
1213
import io.github.vishalmysore.common.CallBackType;
@@ -18,6 +19,7 @@
1819
* It will get automatically exposed as a tool in the A2A framework
1920
* This is the service class which will be used to compare 2 cars
2021
*
22+
* Each action has access to AIProcessor and ActionCallback which are autowired by tools4ai
2123
*/
2224
@Service
2325
@Log
@@ -26,8 +28,17 @@ public class CompareCarService{
2628
public CompareCarService() {
2729
log.info("created compare car service");
2830
}
31+
32+
/**
33+
* Each action has access to AIProcessor and ActionCallback which are autowired by tools4ai
34+
*/
2935
private ActionCallback callback;
3036

37+
/**
38+
* Each action has access to AIProcessor and ActionCallback which are autowired by tools4ai
39+
*/
40+
private AIProcessor processor;
41+
3142
@Action(description = "compare 2 cars")
3243
public String compareCar(String car1 , String car2) {
3344

src/main/java/io/github/vishalmysore/service/RaiseCustomerTicket.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,24 @@
55

66
import com.t4a.api.JavaMethodAction;
77

8+
import com.t4a.detect.ActionCallback;
9+
import com.t4a.processor.AIProcessor;
810
import lombok.extern.java.Log;
911
import org.springframework.stereotype.Service;
1012

1113
@Service
1214
@Log
1315
@Agent(groupName ="raiseTicket", groupDescription = "Create a ticket for customer")
1416
public class RaiseCustomerTicket {
17+
/**
18+
* Each action has access to AIProcessor and ActionCallback which are autowired by tools4ai
19+
*/
20+
private ActionCallback callback;
21+
22+
/**
23+
* Each action has access to AIProcessor and ActionCallback which are autowired by tools4ai
24+
*/
25+
private AIProcessor processor;
1526
@Action(description = "Raise a ticket for customer")
1627
public String raiseTicket(String customerName) {
1728

0 commit comments

Comments
 (0)