Compare commits

...

9 Commits

Author SHA1 Message Date
github-actions[bot]
e4ac322227 Update version to v1.4.154 and commit 2025-03-09 08:56:50 +00:00
Eugen Eisler
1fc19da19f Merge pull request #1349 from ksylvan/03-08-extra-version-declaration-removed
Fix: v1.4.153 does not compile because of extra version declaration
2025-03-09 09:55:37 +01:00
Kayvan Sylvan
e28ba224b5 fix: update Azure client API version access path in tests 2025-03-08 09:52:20 -08:00
Kayvan Sylvan
5b7697c5ab chore: remove unnecessary version variable from main.go 2025-03-08 09:29:20 -08:00
github-actions[bot]
0701b7d263 Update version to v1.4.153 and commit 2025-03-08 08:56:19 +00:00
Eugen Eisler
aac29025fb Merge pull request #1348 from liyuankui/feature/add-litellm-vendor
feat: Add LiteLLM AI plugin support with local endpoint configuration
2025-03-08 09:55:08 +01:00
kyle
6928f9a312 feat: Add LiteLLM AI plugin support with local endpoint configuration 2025-03-08 11:37:54 +08:00
github-actions[bot]
ef2e985d3f Update version to v1.4.152 and commit 2025-03-07 08:23:45 +00:00
Eugen Eisler
1df945556d fix: Fix pipe handling 2025-03-07 09:22:26 +01:00
6 changed files with 45 additions and 26 deletions

View File

@@ -9,9 +9,6 @@ import (
"reflect"
"strconv"
"strings"
"time"
"golang.org/x/term"
"github.com/danielmiessler/fabric/common"
"github.com/jessevdk/go-flags"
@@ -155,13 +152,15 @@ func Init() (ret *Flags, err error) {
}
// Handle stdin and messages
// Handle stdin and messages
info, _ := os.Stdin.Stat()
pipedToStdin := (info.Mode() & os.ModeCharDevice) == 0
// Append positional arguments to the message (custom message)
if len(args) > 0 {
ret.Message = AppendMessage(ret.Message, args[len(args)-1])
}
pipedToStdin := !term.IsTerminal(int(os.Stdin.Fd()))
if pipedToStdin {
var pipedMessage string
if pipedMessage, err = readStdin(); err != nil {
@@ -234,24 +233,17 @@ func loadYAMLConfig(configPath string) (*Flags, error) {
func readStdin() (ret string, err error) {
reader := bufio.NewReader(os.Stdin)
var sb strings.Builder
done := make(chan struct{})
go func() {
for {
line, readErr := reader.ReadString('\n')
if readErr != nil {
if errors.Is(readErr, io.EOF) {
sb.WriteString(strings.TrimSpace(line)) // Ensure last line is added
}
close(done)
return
for {
if line, readErr := reader.ReadString('\n'); readErr != nil {
if errors.Is(readErr, io.EOF) {
sb.WriteString(line)
break
}
err = fmt.Errorf("error reading piped message from stdin: %w", readErr)
return
} else {
sb.WriteString(line)
}
}()
select {
case <-done:
case <-time.After(2 * time.Second):
}
ret = sb.String()
return

View File

@@ -20,6 +20,7 @@ import (
"github.com/danielmiessler/fabric/plugins/ai/dryrun"
"github.com/danielmiessler/fabric/plugins/ai/gemini"
"github.com/danielmiessler/fabric/plugins/ai/groq"
"github.com/danielmiessler/fabric/plugins/ai/litellm"
"github.com/danielmiessler/fabric/plugins/ai/lmstudio"
"github.com/danielmiessler/fabric/plugins/ai/mistral"
"github.com/danielmiessler/fabric/plugins/ai/ollama"
@@ -53,11 +54,22 @@ func NewPluginRegistry(db *fsdb.Db) (ret *PluginRegistry, err error) {
ret.Defaults = tools.NeeDefaults(ret.GetModels)
ret.VendorsAll.AddVendors(openai.NewClient(), ollama.NewClient(), azure.NewClient(), groq.NewClient(),
ret.VendorsAll.AddVendors(
openai.NewClient(),
ollama.NewClient(),
azure.NewClient(),
groq.NewClient(),
gemini.NewClient(),
//gemini_openai.NewClient(),
anthropic.NewClient(), siliconcloud.NewClient(),
openrouter.NewClient(), lmstudio.NewClient(), mistral.NewClient(), deepseek.NewClient(), exolab.NewClient())
anthropic.NewClient(),
siliconcloud.NewClient(),
openrouter.NewClient(),
lmstudio.NewClient(),
mistral.NewClient(),
deepseek.NewClient(),
exolab.NewClient(),
litellm.NewClient(),
)
_ = ret.Configure()
return

View File

@@ -1 +1 @@
"1.4.151"
"1.4.154"

View File

@@ -48,8 +48,8 @@ func TestClientConfigure(t *testing.T) {
t.Errorf("Expected ApiClient to be initialized, got nil")
}
if client.ApiClient.Config.APIVersion != "2021-01-01" {
t.Errorf("Expected API version to be '2021-01-01', got %s", client.ApiClient.Config.APIVersion)
if client.ApiVersion.Value != "2021-01-01" {
t.Errorf("Expected API version to be '2021-01-01', got %s", client.ApiVersion.Value)
}
}

View File

@@ -0,0 +1,15 @@
package litellm
import (
"github.com/danielmiessler/fabric/plugins/ai/openai"
)
func NewClient() (ret *Client) {
ret = &Client{}
ret.Client = openai.NewClientCompatible("LiteLLM", "http://localhost:4000", nil)
return
}
type Client struct {
*openai.Client
}

View File

@@ -1,3 +1,3 @@
package main
var version = "v1.4.151"
var version = "v1.4.154"