Skip to content

Commit 8238c6b

Browse files
author
Yuriy Bezsonov
committed
Update demo-scripts
1 parent ba182fb commit 8238c6b

File tree

8 files changed

+38
-36
lines changed

8 files changed

+38
-36
lines changed

samples/spring-ai-te-agent/ai-agent/src/main/java/com/example/ai/agent/service/ChatService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public class ChatService {
3636
Remember: Being honest about limitations builds trust. Always choose "I don't know" over potentially incorrect information.
3737
""";
3838

39-
public ChatService(ChatClient.Builder chatClientBuilder,
40-
ChatMemoryService chatMemoryService,
39+
public ChatService(ChatMemoryService chatMemoryService,
4140
VectorStore vectorStore,
4241
DateTimeService dateTimeService,
43-
ToolCallbackProvider tools) {
42+
ToolCallbackProvider tools,
43+
ChatClient.Builder chatClientBuilder) {
4444
this.chatClient = chatClientBuilder
4545
.defaultSystem(SYSTEM_PROMPT)
4646
.defaultAdvisors(

samples/spring-ai-te-agent/demo-scripts/02-add-memory.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ fi
3535

3636
# Change to ai-agent directory and commit changes
3737
echo "Committing previous changes..."
38-
cd ai-agent
3938
git add .
4039
git commit -m "add ChatController"
4140

41+
cd ai-agent
42+
4243
echo "Copying ChatMemoryService.java..."
4344
cp "$SOURCES_FOLDER/ai-agent/src/main/java/com/example/ai/agent/service/ChatMemoryService.java" src/main/java/com/example/ai/agent/service/
4445

samples/spring-ai-te-agent/demo-scripts/05-add-mcp.sh

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,6 @@ if [ ! -d "ai-agent" ]; then
1515
exit 1
1616
fi
1717

18-
# Check if backoffice folder exists and delete it if it does
19-
echo "Checking for backoffice folder..."
20-
if [ -d "backoffice" ]; then
21-
echo "Found existing backoffice folder, removing it..."
22-
rm -rf backoffice
23-
fi
24-
25-
Copy backoffice folder from source
26-
echo "Copying backoffice folder from source..."
27-
if [ -d "$SOURCES_FOLDER/backoffice" ]; then
28-
cp -r "$SOURCES_FOLDER/backoffice" .
29-
echo "backoffice folder copied successfully."
30-
else
31-
echo "Error: backoffice folder not found at $SOURCES_FOLDER/backoffice."
32-
echo "Please ensure the folder exists at the specified location."
33-
exit 1
34-
fi
35-
3618
# Check if travel folder exists and delete it if it does
3719
echo "Checking for travel folder..."
3820
if [ -d "travel" ]; then
@@ -62,13 +44,12 @@ echo "Copying ChatService.java from version 5..."
6244
cp "$SOURCES_FOLDER/demo-scripts/Steps/ChatService.java.5" src/main/java/com/example/ai/agent/service/ChatService.java
6345
# code src/main/java/com/example/ai-agent/ChatService.java
6446

65-
echo "Updating application.properties with database configuration..."
47+
echo "Updating application.properties with mcp configuration..."
6648
cat >> src/main/resources/application.properties << 'EOL'
6749
6850
# MCP Client Configuration
6951
spring.ai.mcp.client.toolcallback.enabled=true
70-
spring.ai.mcp.client.sse.connections.server1.url=http://localhost:8081
71-
spring.ai.mcp.client.sse.connections.server2.url=http://localhost:8082
52+
spring.ai.mcp.client.sse.connections.server1.url=http://localhost:8082
7253
EOL
7354

7455
# echo "Opening application.properties in VS Code..."

samples/spring-ai-te-agent/demo-scripts/06-add-multi.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@ if [ ! -d "ai-agent" ]; then
1515
exit 1
1616
fi
1717

18+
19+
# Check if backoffice folder exists and delete it if it does
20+
echo "Checking for backoffice folder..."
21+
if [ -d "backoffice" ]; then
22+
echo "Found existing backoffice folder, removing it..."
23+
rm -rf backoffice
24+
fi
25+
26+
Copy backoffice folder from source
27+
echo "Copying backoffice folder from source..."
28+
if [ -d "$SOURCES_FOLDER/backoffice" ]; then
29+
cp -r "$SOURCES_FOLDER/backoffice" .
30+
echo "backoffice folder copied successfully."
31+
else
32+
echo "Error: backoffice folder not found at $SOURCES_FOLDER/backoffice."
33+
echo "Please ensure the folder exists at the specified location."
34+
exit 1
35+
fi
36+
1837
# Change to ai-agent directory and commit changes
1938
echo "Committing previous changes..."
2039
git add .
@@ -27,6 +46,7 @@ cp "$SOURCES_FOLDER/ai-agent/src/main/java/com/example/ai/agent/service/Document
2746

2847
echo "Updating application.properties with database configuration..."
2948
cat >> src/main/resources/application.properties << 'EOL'
49+
spring.ai.mcp.client.sse.connections.server2.url=http://localhost:8081
3050
3151
# Document processing model
3252
ai.agent.document.model=global.anthropic.claude-sonnet-4-20250514-v1:0

samples/spring-ai-te-agent/demo-scripts/Steps/ChatService.java.2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public class ChatService {
3232
Remember: Being honest about limitations builds trust. Always choose "I don't know" over potentially incorrect information.
3333
""";
3434

35-
public ChatService(ChatClient.Builder chatClientBuilder,
36-
ChatMemoryService chatMemoryService) {
35+
public ChatService(ChatMemoryService chatMemoryService,
36+
ChatClient.Builder chatClientBuilder) {
3737
this.chatClient = chatClientBuilder
3838
.defaultSystem(SYSTEM_PROMPT)
3939
.build();

samples/spring-ai-te-agent/demo-scripts/Steps/ChatService.java.3

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public class ChatService {
3434
Remember: Being honest about limitations builds trust. Always choose "I don't know" over potentially incorrect information.
3535
""";
3636

37-
public ChatService(ChatClient.Builder chatClientBuilder,
38-
ChatMemoryService chatMemoryService,
39-
VectorStore vectorStore) {
37+
public ChatService(ChatMemoryService chatMemoryService,
38+
VectorStore vectorStore,
39+
ChatClient.Builder chatClientBuilder) {
4040
this.chatClient = chatClientBuilder
4141
.defaultSystem(SYSTEM_PROMPT)
4242
.defaultAdvisors(

samples/spring-ai-te-agent/demo-scripts/Steps/ChatService.java.4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public class ChatService {
3535
Remember: Being honest about limitations builds trust. Always choose "I don't know" over potentially incorrect information.
3636
""";
3737

38-
public ChatService(ChatClient.Builder chatClientBuilder,
39-
ChatMemoryService chatMemoryService,
38+
public ChatService(ChatMemoryService chatMemoryService,
4039
VectorStore vectorStore,
41-
DateTimeService dateTimeService) {
40+
DateTimeService dateTimeService,
41+
ChatClient.Builder chatClientBuilder) {
4242
this.chatClient = chatClientBuilder
4343
.defaultSystem(SYSTEM_PROMPT)
4444
.defaultAdvisors(

samples/spring-ai-te-agent/demo-scripts/Steps/ChatService.java.5

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public class ChatService {
3636
Remember: Being honest about limitations builds trust. Always choose "I don't know" over potentially incorrect information.
3737
""";
3838

39-
public ChatService(ChatClient.Builder chatClientBuilder,
40-
ChatMemoryService chatMemoryService,
39+
public ChatService(ChatMemoryService chatMemoryService,
4140
VectorStore vectorStore,
4241
DateTimeService dateTimeService,
43-
ToolCallbackProvider tools) {
42+
ToolCallbackProvider tools,
43+
ChatClient.Builder chatClientBuilder) {
4444
this.chatClient = chatClientBuilder
4545
.defaultSystem(SYSTEM_PROMPT)
4646
.defaultAdvisors(

0 commit comments

Comments
 (0)