Skip to content

Commit

Permalink
feat: Added Deepseek AI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
wmahfoudh committed Jan 23, 2025
1 parent c2fad4d commit a77efad
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/plugin_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/danielmiessler/fabric/plugins/ai/openai"
"github.com/danielmiessler/fabric/plugins/ai/openrouter"
"github.com/danielmiessler/fabric/plugins/ai/siliconcloud"
"github.com/danielmiessler/fabric/plugins/ai/deepseek"
"github.com/danielmiessler/fabric/plugins/db/fsdb"
"github.com/danielmiessler/fabric/plugins/template"
"github.com/danielmiessler/fabric/plugins/tools"
Expand Down Expand Up @@ -53,7 +54,7 @@ func NewPluginRegistry(db *fsdb.Db) (ret *PluginRegistry, err error) {
gemini.NewClient(),
//gemini_openai.NewClient(),
anthropic.NewClient(), siliconcloud.NewClient(),
openrouter.NewClient(), mistral.NewClient())
openrouter.NewClient(), mistral.NewClient(), deepseek.NewClient())
_ = ret.Configure()

return
Expand Down
15 changes: 15 additions & 0 deletions plugins/ai/deepseek/deepseek.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package deepseek

import (
"github.com/danielmiessler/fabric/plugins/ai/openai"
)

func NewClient() (ret *Client) {
ret = &Client{}
ret.Client = openai.NewClientCompatible("DeepSeek", "https://api.deepseek.com", nil)
return
}

type Client struct {
*openai.Client
}
4 changes: 4 additions & 0 deletions restapi/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (h *ConfigHandler) GetConfig(c *gin.Context) {
"ollama": "",
"openrouter": "",
"silicon": "",
"deepseek": "",
})
return
}
Expand All @@ -63,6 +64,7 @@ func (h *ConfigHandler) GetConfig(c *gin.Context) {
"ollama": os.Getenv("OLLAMA_URL"),
"openrouter": os.Getenv("OPENROUTER_API_KEY"),
"silicon": os.Getenv("SILICON_API_KEY"),
"deepseek": os.Getenv("DEEPSEEK_API_KEY"),
}

c.JSON(http.StatusOK, config)
Expand All @@ -83,6 +85,7 @@ func (h *ConfigHandler) UpdateConfig(c *gin.Context) {
OllamaURL string `json:"ollama_url"`
OpenRouterApiKey string `json:"openrouter_api_key"`
SiliconApiKey string `json:"silicon_api_key"`
DeepSeekApiKey string `json:"deepseek_api_key"`
}

if err := c.BindJSON(&config); err != nil {
Expand All @@ -99,6 +102,7 @@ func (h *ConfigHandler) UpdateConfig(c *gin.Context) {
"OLLAMA_URL": config.OllamaURL,
"OPENROUTER_API_KEY": config.OpenRouterApiKey,
"SILICON_API_KEY": config.SiliconApiKey,
"DEEPSEEK_API_KEY": config.DeepSeekApiKey,
}

var envContent strings.Builder
Expand Down

0 comments on commit a77efad

Please sign in to comment.