Java 项目集成 DeepSeek,亮点项目(包成功)

获取 DeepSeek API 并搭建简易问答 Java 应用的完整步骤:“代码星辰阁”公众号有完整代码

Java 项目集成 DeepSeek,亮点项目(包成功)_第1张图片

获取 DeepSeek API Key

  1. 访问 DeepSeek 官网:打开 DeepSeek 开放平台,点击右上角的“开放平台”。

  2. 注册或登录账号:新注册账号通常会赠送一定数量的免费 tokens。

Java 项目集成 DeepSeek,亮点项目(包成功)_第2张图片

  1. 创建 API Key

    1. 在左侧菜单中点击 API Keys

    2. 点击“创建 API Key”,为 API Key 命名(如“test”),然后创建。

    3. 系统会生成一个 API Key,请务必复制并妥善保存,因为之后无法再次查看。

以下是基于 Spring Boot 集成 DeepSeek API 并搭建简易问答应用的完整步骤,同时包含完整的数据库表结构设计。我们将使用 spring-ai-openai-spring-boot-starter 依赖来简化集成过程。

1. 创建 Spring Boot 项目

使用 Spring Initializr 创建一个新的 Spring Boot 项目,选择以下依赖:

  • Spring Web

2. 添加依赖

pom.xml 文件中添加以下依赖:


            
                org.springframework.boot
                spring-boot-starter-web
            
            
                org.springframework.boot
                spring-boot-starter-webflux
            
            
                com.fasterxml.jackson.core
                jackson-databind
            
        
            org.projectlombok
            lombok
            true
        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
  

你可能感兴趣的:(springboot,编程,spring,boot,deepseek,人工智能,java)