mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-08 22:08:03 -05:00
flake: fix/update
This commit is contained in:
2
.envrc
2
.envrc
@@ -1,2 +1,2 @@
|
|||||||
watch_file shell.nix
|
watch_file nix/shell.nix
|
||||||
use flake
|
use flake
|
||||||
|
|||||||
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -22,6 +22,9 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
@@ -29,3 +32,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: go test -v ./...
|
run: go test -v ./...
|
||||||
|
|
||||||
|
- name: Check Formatting
|
||||||
|
run: nix flake check
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ jobs:
|
|||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
- name: Setup Nix Cache
|
|
||||||
uses: DeterminateSystems/magic-nix-cache-action@main
|
|
||||||
|
|
||||||
- name: Set up Git
|
- name: Set up Git
|
||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
@@ -63,21 +60,21 @@ jobs:
|
|||||||
|
|
||||||
- name: Update version.nix file
|
- name: Update version.nix file
|
||||||
run: |
|
run: |
|
||||||
echo "\"${{ env.new_version }}\"" > pkgs/fabric/version.nix
|
echo "\"${{ env.new_version }}\"" > nix/pkgs/fabric/version.nix
|
||||||
|
|
||||||
- name: Format source codes
|
- name: Format source code
|
||||||
run: |
|
run: |
|
||||||
go fmt ./...
|
nix fmt
|
||||||
|
|
||||||
- name: Update gomod2nix.toml file
|
- name: Update gomod2nix.toml file
|
||||||
run: |
|
run: |
|
||||||
nix run .#gomod2nix
|
nix run .#gomod2nix -- --outdir nix/pkgs/fabric
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
run: |
|
run: |
|
||||||
git add version.go
|
git add version.go
|
||||||
git add pkgs/fabric/version.nix
|
git add nix/pkgs/fabric/version.nix
|
||||||
git add gomod2nix.toml
|
git add nix/pkgs/fabric/gomod2nix.toml
|
||||||
git add .
|
git add .
|
||||||
if ! git diff --staged --quiet; then
|
if ! git diff --staged --quiet; then
|
||||||
git commit -m "Update version to ${{ env.new_tag }} and commit $commit_hash"
|
git commit -m "Update version to ${{ env.new_tag }} and commit $commit_hash"
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/danielmiessler/fabric/core"
|
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/danielmiessler/fabric/core"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ package cli
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/atotto/clipboard"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/atotto/clipboard"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CopyToClipboard(message string) (err error) {
|
func CopyToClipboard(message string) (err error) {
|
||||||
|
|||||||
@@ -6,11 +6,12 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gabriel-vasile/mimetype"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/gabriel-vasile/mimetype"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Attachment struct {
|
type Attachment struct {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
goopenai "github.com/sashabaranov/go-openai"
|
goopenai "github.com/sashabaranov/go-openai"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNormalizeMessages(t *testing.T) {
|
func TestNormalizeMessages(t *testing.T) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package common
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ package core
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/danielmiessler/fabric/plugins/ai/exolab"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/danielmiessler/fabric/plugins/ai/exolab"
|
||||||
|
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
|
|
||||||
"github.com/danielmiessler/fabric/common"
|
"github.com/danielmiessler/fabric/common"
|
||||||
|
|||||||
18
flake.lock
generated
18
flake.lock
generated
@@ -26,11 +26,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1729448365,
|
"lastModified": 1733668782,
|
||||||
"narHash": "sha256-oquZeWTYWTr5IxfwEzgsxjtD8SSFZYLdO9DaQb70vNU=",
|
"narHash": "sha256-tPsqU00FhgdFr0JiQUiBMgPVbl1jbPCY5gbFiJycL3I=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "gomod2nix",
|
"repo": "gomod2nix",
|
||||||
"rev": "5d387097aa716f35dd99d848dc26d8d5b62a104c",
|
"rev": "514283ec89c39ad0079ff2f3b1437404e4cba608",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -41,11 +41,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1729665710,
|
"lastModified": 1736344531,
|
||||||
"narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=",
|
"narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d",
|
"rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -100,11 +100,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1729613947,
|
"lastModified": 1736154270,
|
||||||
"narHash": "sha256-XGOvuIPW1XRfPgHtGYXd5MAmJzZtOuwlfKDgxX5KT3s=",
|
"narHash": "sha256-p2r8xhQZ3TYIEKBoiEhllKWQqWNJNoT9v64Vmg4q8Zw=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "treefmt-nix",
|
"repo": "treefmt-nix",
|
||||||
"rev": "aac86347fb5063960eccb19493e0cadcdb4205ca",
|
"rev": "13c913f5deb3a5c08bb810efd89dc8cb24dd968b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
in
|
in
|
||||||
treefmt-nix.lib.evalModule pkgs ./treefmt.nix
|
treefmt-nix.lib.evalModule pkgs ./nix/treefmt.nix
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
goEnv = gomod2nix.legacyPackages.${system}.mkGoEnv { pwd = ./.; };
|
goEnv = gomod2nix.legacyPackages.${system}.mkGoEnv { pwd = ./.; };
|
||||||
in
|
in
|
||||||
import ./shell.nix {
|
import ./nix/shell.nix {
|
||||||
inherit pkgs goEnv;
|
inherit pkgs goEnv;
|
||||||
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;
|
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = self.packages.${system}.fabric;
|
default = self.packages.${system}.fabric;
|
||||||
fabric = pkgs.callPackage ./pkgs/fabric {
|
fabric = pkgs.callPackage ./nix/pkgs/fabric {
|
||||||
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
|
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
|
||||||
};
|
};
|
||||||
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;
|
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;
|
||||||
|
|||||||
3
main.go
3
main.go
@@ -2,9 +2,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/jessevdk/go-flags"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/jessevdk/go-flags"
|
||||||
|
|
||||||
"github.com/danielmiessler/fabric/cli"
|
"github.com/danielmiessler/fabric/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,11 @@
|
|||||||
buildGoApplication {
|
buildGoApplication {
|
||||||
pname = "fabric-ai";
|
pname = "fabric-ai";
|
||||||
version = import ./version.nix;
|
version = import ./version.nix;
|
||||||
src = ../../.;
|
src = ../../../.;
|
||||||
pwd = ../../.;
|
pwd = ../../../.;
|
||||||
modules = ../../gomod2nix.toml;
|
modules = ./gomod2nix.toml;
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
ldflags = [
|
ldflags = [
|
||||||
"-s"
|
"-s"
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
statix.enable = true;
|
statix.enable = true;
|
||||||
nixfmt.enable = true;
|
nixfmt.enable = true;
|
||||||
|
|
||||||
|
goimports.enable = true;
|
||||||
gofmt.enable = true;
|
gofmt.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
package azure
|
package azure
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/danielmiessler/fabric/plugins"
|
"github.com/danielmiessler/fabric/plugins"
|
||||||
"github.com/danielmiessler/fabric/plugins/ai/openai"
|
"github.com/danielmiessler/fabric/plugins/ai/openai"
|
||||||
goopenai "github.com/sashabaranov/go-openai"
|
goopenai "github.com/sashabaranov/go-openai"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewClient() (ret *Client) {
|
func NewClient() (ret *Client) {
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package dryrun
|
package dryrun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/danielmiessler/fabric/common"
|
|
||||||
"github.com/sashabaranov/go-openai"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/danielmiessler/fabric/common"
|
||||||
|
"github.com/sashabaranov/go-openai"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test generated using Keploy
|
// Test generated using Keploy
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package exolab
|
package exolab
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/danielmiessler/fabric/plugins"
|
"github.com/danielmiessler/fabric/plugins"
|
||||||
"github.com/danielmiessler/fabric/plugins/ai/openai"
|
"github.com/danielmiessler/fabric/plugins/ai/openai"
|
||||||
"strings"
|
|
||||||
|
|
||||||
goopenai "github.com/sashabaranov/go-openai"
|
goopenai "github.com/sashabaranov/go-openai"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/danielmiessler/fabric/plugins"
|
"github.com/danielmiessler/fabric/plugins"
|
||||||
goopenai "github.com/sashabaranov/go-openai"
|
goopenai "github.com/sashabaranov/go-openai"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/danielmiessler/fabric/common"
|
"github.com/danielmiessler/fabric/common"
|
||||||
"github.com/google/generative-ai-go/genai"
|
"github.com/google/generative-ai-go/genai"
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package gemini
|
package gemini
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/generative-ai-go/genai"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/google/generative-ai-go/genai"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test generated using Keploy
|
// Test generated using Keploy
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/danielmiessler/fabric/plugins"
|
|
||||||
"io"
|
"io"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
|
"github.com/danielmiessler/fabric/plugins"
|
||||||
|
|
||||||
"github.com/danielmiessler/fabric/common"
|
"github.com/danielmiessler/fabric/common"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/sashabaranov/go-openai"
|
"github.com/sashabaranov/go-openai"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package ai
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/danielmiessler/fabric/plugins"
|
"github.com/danielmiessler/fabric/plugins"
|
||||||
goopenai "github.com/sashabaranov/go-openai"
|
goopenai "github.com/sashabaranov/go-openai"
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/danielmiessler/fabric/plugins"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/danielmiessler/fabric/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewVendorsManager() *VendorsManager {
|
func NewVendorsManager() *VendorsManager {
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ package fsdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/joho/godotenv"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewDb(dir string) (db *Db) {
|
func NewDb(dir string) (db *Db) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package fsdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/danielmiessler/fabric/common"
|
"github.com/danielmiessler/fabric/common"
|
||||||
goopenai "github.com/sashabaranov/go-openai"
|
goopenai "github.com/sashabaranov/go-openai"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package fsdb
|
package fsdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
goopenai "github.com/sashabaranov/go-openai"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
goopenai "github.com/sashabaranov/go-openai"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSessions_GetOrCreateSession(t *testing.T) {
|
func TestSessions_GetOrCreateSession(t *testing.T) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package converter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/go-shiori/go-readability"
|
"github.com/go-shiori/go-readability"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/danielmiessler/fabric/core"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/danielmiessler/fabric/core"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OllamaModel struct {
|
type OllamaModel struct {
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ package restapi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/danielmiessler/fabric/plugins/db"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/danielmiessler/fabric/plugins/db"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StorageHandler defines the handler for storage-related operations
|
// StorageHandler defines the handler for storage-related operations
|
||||||
|
|||||||
Reference in New Issue
Block a user