🙇♂️
This file contains hidden or 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
| package dev.tpcoder.application.service; | |
| import dev.tpcoder.application.dto.GetNewsByPreferenceResponse; | |
| import dev.tpcoder.application.dto.GetNewsRequest; | |
| import dev.tpcoder.application.dto.GetNewsResponse; | |
| import dev.tpcoder.application.util.AgentUtil; | |
| import org.springframework.ai.chat.client.ChatClient; | |
| import org.springframework.ai.openai.OpenAiChatModel; | |
| import org.springframework.beans.factory.annotation.Value; | |
| import org.springframework.stereotype.Service; |
This file contains hidden or 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
| package dev.tpcoder.application.agent; | |
| import dev.tpcoder.application.dto.GetNewsByPreferenceRequest; | |
| import dev.tpcoder.application.dto.GetNewsByPreferenceResponse; | |
| import dev.tpcoder.application.dto.UserPreferenceRequest; | |
| import dev.tpcoder.application.dto.UserPreferenceResponse; | |
| import dev.tpcoder.application.repository.UserPreferencesRepository; | |
| import dev.tpcoder.application.service.NewsService; | |
| import dev.tpcoder.application.service.agent.GetNewsByUserPreferences; | |
| import dev.tpcoder.application.service.agent.UserPreferencesService; |
This file contains hidden or 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
| package dev.tpcoder.application.controller; | |
| import dev.tpcoder.application.agent.AiAgentConfig; | |
| import dev.tpcoder.application.dto.NewSummarized; | |
| import dev.tpcoder.application.util.AgentUtil; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import org.springframework.ai.chat.messages.UserMessage; | |
| import org.springframework.ai.chat.model.ChatResponse; | |
| import org.springframework.ai.chat.model.Generation; |
This file contains hidden or 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
| spring: | |
| application: | |
| name: spring-ai-function-calling | |
| ai: | |
| openai: | |
| api-key: ${OPEN_API_KEY:} | |
| sql: | |
| init: | |
| mode: always |
This file contains hidden or 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
| INSERT INTO USER_PREFERENCES (id, category) VALUES | |
| (1,'science'), | |
| (2,'technology'); |
This file contains hidden or 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
| class Solution { | |
| private static final int[][] DIRS = new int[][] { | |
| new int[] {-1,0}, | |
| new int[] {1,0}, | |
| new int[] {0,-1}, | |
| new int[] {0,1} | |
| }; | |
| public int[][] updateMatrix(int[][] mat) { |
This file contains hidden or 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
| class Solution { | |
| private static final int[][] DIRS = new int[][] { | |
| new int[] {-1,0}, | |
| new int[] {1,0}, | |
| new int[] {0,-1}, | |
| new int[] {0,1} | |
| }; | |
| public int maxAreaOfIsland(int[][] grid) { |
This file contains hidden or 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
| class Solution { | |
| private static final int[][] DIRS = new int[][] { | |
| new int[] {-1,0}, | |
| new int[] {1,0}, | |
| new int[] {0,-1}, | |
| new int[] {0,1} | |
| }; | |
| public int numIslands(char[][] grid) { |
This file contains hidden or 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
| import java.util.List; | |
| public class Playground { | |
| public static void main(String[] args) { | |
| var nums = List.of(1, 2, 3, 15, 35, 53, 81); | |
| System.out.println("Element 35 exists: " + binarySearch(nums, 35)); | |
| System.out.println("Element 40 exists: " + binarySearch(nums, 40)); | |
| } |
This file contains hidden or 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
| name: Release to Cloudflare Page | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pages: write |