Improve import path

This commit is contained in:
Yang Luo 2023-10-08 17:36:35 +08:00
parent e247f85dda
commit d389774c1c
55 changed files with 101 additions and 103 deletions

View File

@ -81,7 +81,7 @@ jobs:
release-and-push: release-and-push:
name: Release And Push name: Release And Push
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'casbin/casibase' && github.event_name == 'push' if: github.repository == 'casibase/casibase' && github.event_name == 'push'
needs: [ frontend, backend, linter] needs: [ frontend, backend, linter]
steps: steps:
- name: Checkout - name: Checkout
@ -138,14 +138,14 @@ jobs:
- name: Log in to Docker Hub - name: Log in to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v1
if: github.repository == 'casbin/casibase' && github.event_name == 'push' && steps.should_push.outputs.push=='true' if: github.repository == 'casibase/casibase' && github.event_name == 'push' && steps.should_push.outputs.push=='true'
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }} password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push to Docker Hub - name: Push to Docker Hub
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
if: github.repository == 'casbin/casibase' && github.event_name == 'push' && steps.should_push.outputs.push=='true' if: github.repository == 'casibase/casibase' && github.event_name == 'push' && steps.should_push.outputs.push=='true'
with: with:
context: . context: .
target: STANDARD target: STANDARD

View File

@ -7,7 +7,7 @@ on:
jobs: jobs:
synchronize-with-crowdin: synchronize-with-crowdin:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'casbin/casibase' && github.event_name == 'push' if: github.repository == 'casibase/casibase' && github.event_name == 'push'
steps: steps:
- name: Checkout - name: Checkout

View File

@ -7,37 +7,37 @@
<a href="https://hub.docker.com/r/casbin/casibase"> <a href="https://hub.docker.com/r/casbin/casibase">
<img alt="docker pull casbin/casibase" src="https://img.shields.io/docker/pulls/casbin/casibase.svg"> <img alt="docker pull casbin/casibase" src="https://img.shields.io/docker/pulls/casbin/casibase.svg">
</a> </a>
<a href="https://github.com/casbin/casibase/actions/workflows/build.yml"> <a href="https://github.com/casibase/casibase/actions/workflows/build.yml">
<img alt="GitHub Workflow Status (branch)" src="https://github.com/casbin/casibase/workflows/Build/badge.svg?style=flat-square"> <img alt="GitHub Workflow Status (branch)" src="https://github.com/casibase/casibase/workflows/Build/badge.svg?style=flat-square">
</a> </a>
<a href="https://github.com/casbin/casibase/releases/latest"> <a href="https://github.com/casibase/casibase/releases/latest">
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/casbin/casibase.svg"> <img alt="GitHub Release" src="https://img.shields.io/github/v/release/casibase/casibase.svg">
</a> </a>
<a href="https://hub.docker.com/repository/docker/casbin/casibase"> <a href="https://hub.docker.com/repository/docker/casbin/casibase">
<img alt="Docker Image Version (latest semver)" src="https://img.shields.io/badge/Docker%20Hub-latest-brightgreen"> <img alt="Docker Image Version (latest semver)" src="https://img.shields.io/badge/Docker%20Hub-latest-brightgreen">
</a> </a>
<!-- waiting for changing --> <!-- waiting for changing -->
<!-- <a href="https://hub.docker.com/r/casbin/casibase"> --> <!-- <a href="https://hub.docker.com/r/casbin/casibase"> -->
<!-- <a href="https://github.com/casbin/casibase/actions/workflows/build.yml"> --> <!-- <a href="https://github.com/casibase/casibase/actions/workflows/build.yml"> -->
<!-- <a href="https://github.com/casbin/casibase/releases/latest"> --> <!-- <a href="https://github.com/casibase/casibase/releases/latest"> -->
<!-- <a href="https://hub.docker.com/repository/docker/casbin/casibase"> --> <!-- <a href="https://hub.docker.com/repository/docker/casbin/casibase"> -->
</p> </p>
<p align="center"> <p align="center">
<a href="https://goreportcard.com/report/github.com/casbin/casibase"> <a href="https://goreportcard.com/report/github.com/casibase/casibase">
<img alt="Go Report Card" src="https://goreportcard.com/badge/github.com/casbin/casibase?style=flat-square"> <img alt="Go Report Card" src="https://goreportcard.com/badge/github.com/casibase/casibase?style=flat-square">
</a> </a>
<a href="https://github.com/casbin/casibase/blob/master/LICENSE"> <a href="https://github.com/casibase/casibase/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/casbin/casibase?style=flat-square" alt="license"> <img src="https://img.shields.io/github/license/casibase/casibase?style=flat-square" alt="license">
</a> </a>
<a href="https://github.com/casbin/casibase/issues"> <a href="https://github.com/casibase/casibase/issues">
<img alt="GitHub issues" src="https://img.shields.io/github/issues/casbin/casibase?style=flat-square"> <img alt="GitHub issues" src="https://img.shields.io/github/issues/casibase/casibase?style=flat-square">
</a> </a>
<a href="#"> <a href="#">
<img alt="GitHub stars" src="https://img.shields.io/github/stars/casbin/casibase?style=flat-square"> <img alt="GitHub stars" src="https://img.shields.io/github/stars/casibase/casibase?style=flat-square">
</a> </a>
<a href="https://github.com/casbin/casibase/network"> <a href="https://github.com/casibase/casibase/network">
<img alt="GitHub forks" src="https://img.shields.io/github/forks/casbin/casibase?style=flat-square"> <img alt="GitHub forks" src="https://img.shields.io/github/forks/casibase/casibase?style=flat-square">
</a> </a>
<a href="https://crowdin.com/project/casibase"> <a href="https://crowdin.com/project/casibase">
<img alt="Crowdin" src="https://badges.crowdin.net/casibase/localized.svg"> <img alt="Crowdin" src="https://badges.crowdin.net/casibase/localized.svg">
@ -49,7 +49,7 @@
## Online Demo ## Online Demo
<https://ai.casbin.com> <https://ai.v2tl.com>
## Architecture ## Architecture
@ -100,13 +100,11 @@ Casibase contains 2 parts:
Discord: <https://discord.gg/5rPsrAzK7S> Discord: <https://discord.gg/5rPsrAzK7S>
Forum: <https://forum.casbin.com>
Contact: <https://tawk.to/chat/623352fea34c2456412b8c51/1fuc7od6e>
## Contribute ## Contribute
For Casibase, if you have any questions, you can give issues, or you can also directly start Pull Requests(but we recommend giving issues first to communicate with the community). For Casibase, if you have any questions, you can give issues, or you can also directly start Pull Requests(but we recommend giving issues first to communicate with the community).
## License ## License
[Apache-2.0](https://github.com/casbin/casibase/blob/master/LICENSE)
[Apache-2.0](https://github.com/casibase/casibase/blob/master/LICENSE)

View File

@ -17,7 +17,7 @@ package controllers
import ( import (
"encoding/json" "encoding/json"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
) )
func (c *ApiController) GetGlobalChats() { func (c *ApiController) GetGlobalChats() {

View File

@ -17,7 +17,7 @@ package controllers
import ( import (
"encoding/json" "encoding/json"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
) )
func (c *ApiController) GetGlobalFactorsets() { func (c *ApiController) GetGlobalFactorsets() {

View File

@ -18,7 +18,7 @@ import (
"encoding/json" "encoding/json"
"mime/multipart" "mime/multipart"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
) )
func (c *ApiController) UpdateFile() { func (c *ApiController) UpdateFile() {

View File

@ -19,7 +19,7 @@ import (
"strings" "strings"
"github.com/astaxie/beego" "github.com/astaxie/beego"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
) )
var ( var (

View File

@ -19,8 +19,8 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
) )
func (c *ApiController) GetGlobalMessages() { func (c *ApiController) GetGlobalMessages() {

View File

@ -17,10 +17,10 @@ package controllers
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/embedding" "github.com/casibase/casibase/embedding"
"github.com/casbin/casibase/model" "github.com/casibase/casibase/model"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
) )
func (c *ApiController) ResponseErrorStream(errorText string) { func (c *ApiController) ResponseErrorStream(errorText string) {

View File

@ -17,8 +17,8 @@ package controllers
import ( import (
"encoding/json" "encoding/json"
"github.com/casbin/casibase/util"
"github.com/casdoor/casdoor-go-sdk/casdoorsdk" "github.com/casdoor/casdoor-go-sdk/casdoorsdk"
"github.com/casibase/casibase/util"
) )
func (c *ApiController) GetPermissions() { func (c *ApiController) GetPermissions() {

View File

@ -17,7 +17,7 @@ package controllers
import ( import (
"encoding/json" "encoding/json"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
) )
func (c *ApiController) GetGlobalProviders() { func (c *ApiController) GetGlobalProviders() {

View File

@ -20,7 +20,7 @@ import (
"net" "net"
"strings" "strings"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
) )
func (c *ApiController) GetGlobalStores() { func (c *ApiController) GetGlobalStores() {

View File

@ -17,7 +17,7 @@ package controllers
import ( import (
"encoding/json" "encoding/json"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
) )
func (c *ApiController) GetGlobalTasks() { func (c *ApiController) GetGlobalTasks() {

View File

@ -19,8 +19,8 @@ import (
"strings" "strings"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/context"
"github.com/casbin/casibase/util"
"github.com/casdoor/casdoor-go-sdk/casdoorsdk" "github.com/casdoor/casdoor-go-sdk/casdoorsdk"
"github.com/casibase/casibase/util"
) )
func NewRecord(ctx *context.Context) *casdoorsdk.Record { func NewRecord(ctx *context.Context) *casdoorsdk.Record {

View File

@ -17,7 +17,7 @@ package controllers
import ( import (
"encoding/json" "encoding/json"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
) )
func (c *ApiController) GetGlobalVectors() { func (c *ApiController) GetGlobalVectors() {

View File

@ -21,9 +21,9 @@ import (
"io" "io"
"time" "time"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"github.com/casbin/casibase/video" "github.com/casibase/casibase/video"
) )
func (c *ApiController) GetGlobalVideos() { func (c *ApiController) GetGlobalVideos() {

View File

@ -17,8 +17,8 @@ package controllers
import ( import (
"encoding/json" "encoding/json"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
) )
func (c *ApiController) GetGlobalWordsets() { func (c *ApiController) GetGlobalWordsets() {

View File

@ -17,7 +17,7 @@ package embedding
import ( import (
"context" "context"
"github.com/casbin/casibase/proxy" "github.com/casibase/casibase/proxy"
"github.com/henomis/lingoose/embedder/huggingface" "github.com/henomis/lingoose/embedder/huggingface"
) )

View File

@ -17,8 +17,8 @@ package embedding
import ( import (
"context" "context"
"github.com/casbin/casibase/proxy" "github.com/casibase/casibase/proxy"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"github.com/sashabaranov/go-openai" "github.com/sashabaranov/go-openai"
) )

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/casbin/casibase module github.com/casibase/casibase
go 1.20 go 1.20

View File

@ -21,7 +21,7 @@ import (
"regexp" "regexp"
"strings" "strings"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
) )
type I18nData map[string]map[string]string type I18nData map[string]map[string]string

View File

@ -17,7 +17,7 @@ package i18n
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
) )
func getI18nFilePath(language string) string { func getI18nFilePath(language string) string {

View File

@ -18,9 +18,9 @@ import (
"github.com/astaxie/beego" "github.com/astaxie/beego"
"github.com/astaxie/beego/plugins/cors" "github.com/astaxie/beego/plugins/cors"
_ "github.com/astaxie/beego/session/redis" _ "github.com/astaxie/beego/session/redis"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
"github.com/casbin/casibase/proxy" "github.com/casibase/casibase/proxy"
"github.com/casbin/casibase/routers" "github.com/casibase/casibase/routers"
) )
func main() { func main() {

View File

@ -15,7 +15,7 @@
package model package model
import ( import (
"github.com/casbin/casibase/proxy" "github.com/casibase/casibase/proxy"
"github.com/sashabaranov/go-openai" "github.com/sashabaranov/go-openai"
) )

View File

@ -20,7 +20,7 @@ import (
"io" "io"
"strings" "strings"
"github.com/casbin/casibase/proxy" "github.com/casibase/casibase/proxy"
"github.com/henomis/lingoose/llm/huggingface" "github.com/henomis/lingoose/llm/huggingface"
) )

View File

@ -21,7 +21,7 @@ import (
"net/http" "net/http"
"strings" "strings"
"github.com/casbin/casibase/proxy" "github.com/casibase/casibase/proxy"
"github.com/sashabaranov/go-openai" "github.com/sashabaranov/go-openai"
) )

View File

@ -22,7 +22,7 @@ import (
"strings" "strings"
"github.com/Lok-Lu/go-openrouter" "github.com/Lok-Lu/go-openrouter"
"github.com/casbin/casibase/proxy" "github.com/casibase/casibase/proxy"
) )
type OpenRouterModelProvider struct { type OpenRouterModelProvider struct {

View File

@ -20,9 +20,9 @@ package model_test
import ( import (
"testing" "testing"
"github.com/casbin/casibase/model" "github.com/casibase/casibase/model"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
"github.com/casbin/casibase/proxy" "github.com/casibase/casibase/proxy"
"github.com/sashabaranov/go-openai" "github.com/sashabaranov/go-openai"
) )

View File

@ -17,7 +17,7 @@ package object
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"xorm.io/core" "xorm.io/core"
) )

View File

@ -17,7 +17,7 @@ package object
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"xorm.io/core" "xorm.io/core"
) )

View File

@ -18,7 +18,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
) )
func (factorset *Factorset) LoadFactors(pathPrefix string) { func (factorset *Factorset) LoadFactors(pathPrefix string) {

View File

@ -14,7 +14,7 @@
package object package object
import "github.com/casbin/casibase/util" import "github.com/casibase/casibase/util"
func InitDb() { func InitDb() {
existed := initBuiltInStore() existed := initBuiltInStore()

View File

@ -19,7 +19,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"github.com/muesli/clusters" "github.com/muesli/clusters"
"github.com/muesli/kmeans" "github.com/muesli/kmeans"
) )

View File

@ -17,7 +17,7 @@ package object
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"xorm.io/core" "xorm.io/core"
) )

View File

@ -17,10 +17,10 @@ package object
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/embedding" "github.com/casibase/casibase/embedding"
"github.com/casbin/casibase/model" "github.com/casibase/casibase/model"
"github.com/casbin/casibase/storage" "github.com/casibase/casibase/storage"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"xorm.io/core" "xorm.io/core"
) )

View File

@ -19,7 +19,7 @@ import (
"io/ioutil" "io/ioutil"
"sync" "sync"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"github.com/casibase/go-hnsw" "github.com/casibase/go-hnsw"
) )

View File

@ -17,8 +17,8 @@ package object
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/storage" "github.com/casibase/casibase/storage"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"xorm.io/core" "xorm.io/core"
) )

View File

@ -19,7 +19,7 @@ import (
urllib "net/url" urllib "net/url"
"strings" "strings"
"github.com/casbin/casibase/storage" "github.com/casibase/casibase/storage"
) )
func (store *Store) createPathIfNotExisted(tokens []string, size int64, url string, lastModifiedTime string, isLeaf bool) { func (store *Store) createPathIfNotExisted(tokens []string, size int64, url string, lastModifiedTime string, isLeaf bool) {

View File

@ -17,7 +17,7 @@ package object
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"xorm.io/core" "xorm.io/core"
) )

View File

@ -17,7 +17,7 @@ package object
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"xorm.io/core" "xorm.io/core"
) )

View File

@ -21,11 +21,11 @@ import (
"strings" "strings"
"time" "time"
"github.com/casbin/casibase/embedding" "github.com/casibase/casibase/embedding"
"github.com/casbin/casibase/model" "github.com/casibase/casibase/model"
"github.com/casbin/casibase/storage" "github.com/casibase/casibase/storage"
"github.com/casbin/casibase/txt" "github.com/casibase/casibase/txt"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"golang.org/x/time/rate" "golang.org/x/time/rate"
) )

View File

@ -17,7 +17,7 @@ package object
import ( import (
"testing" "testing"
"github.com/casbin/casibase/model" "github.com/casibase/casibase/model"
) )
func TestUpdateVectors(t *testing.T) { func TestUpdateVectors(t *testing.T) {

View File

@ -17,8 +17,8 @@ package object
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"github.com/casbin/casibase/video" "github.com/casibase/casibase/video"
"xorm.io/core" "xorm.io/core"
) )

View File

@ -17,7 +17,7 @@ package object
import ( import (
"fmt" "fmt"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"xorm.io/core" "xorm.io/core"
) )

View File

@ -20,7 +20,7 @@ import (
"math" "math"
"strconv" "strconv"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
) )
var graphCache map[string]*Graph var graphCache map[string]*Graph

View File

@ -15,8 +15,8 @@
package object package object
import ( import (
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"github.com/casbin/casibase/xlsx" "github.com/casibase/casibase/xlsx"
) )
func uploadFactorNames(owner string, fileId string) (bool, error) { func uploadFactorNames(owner string, fileId string) (bool, error) {

View File

@ -22,7 +22,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/casbin/casibase/conf" "github.com/casibase/casibase/conf"
"golang.org/x/net/proxy" "golang.org/x/net/proxy"
) )

View File

@ -21,9 +21,9 @@ import (
"github.com/astaxie/beego" "github.com/astaxie/beego"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/context"
"github.com/casbin/casibase/conf" "github.com/casibase/casibase/conf"
"github.com/casbin/casibase/controllers" "github.com/casibase/casibase/controllers"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
) )
const ( const (

View File

@ -16,7 +16,7 @@ package routers
import ( import (
"github.com/astaxie/beego" "github.com/astaxie/beego"
"github.com/casbin/casibase/controllers" "github.com/casibase/casibase/controllers"
) )
func init() { func init() {

View File

@ -21,9 +21,9 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/casbin/casibase/controllers" "github.com/casibase/casibase/controllers"
"github.com/casbin/casibase/object" "github.com/casibase/casibase/object"
"github.com/casbin/casibase/storage" "github.com/casibase/casibase/storage"
) )
func TestStorage(t *testing.T) { func TestStorage(t *testing.T) {

View File

@ -20,7 +20,7 @@ import (
"io/ioutil" "io/ioutil"
"path/filepath" "path/filepath"
"github.com/casbin/casibase/proxy" "github.com/casibase/casibase/proxy"
) )
func downloadFile(url string) (*bytes.Buffer, error) { func downloadFile(url string) (*bytes.Buffer, error) {

View File

@ -20,7 +20,7 @@ import (
"time" "time"
"github.com/aliyun/alibaba-cloud-sdk-go/services/vod" "github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
) )
func GetVideoPlayAuth(videoId string) string { func GetVideoPlayAuth(videoId string) string {

View File

@ -445,7 +445,7 @@ class App extends Component {
textAlign: "center", textAlign: "center",
} }
}> }>
Powered by <a style={{fontWeight: "bold", color: "black"}} target="_blank" rel="noreferrer" href="https://github.com/casbin/casibase">Casibase</a> Powered by <a style={{fontWeight: "bold", color: "black"}} target="_blank" rel="noreferrer" href="https://github.com/casibase/casibase">Casibase</a>
</Footer> </Footer>
</React.Fragment> </React.Fragment>
); );

View File

@ -31,7 +31,7 @@ const demoModeCallback = (res) => {
okText: i18next.t("general:OK"), okText: i18next.t("general:OK"),
cancelText: i18next.t("general:Cancel"), cancelText: i18next.t("general:Cancel"),
onOk() { onOk() {
Setting.openLink(`https://demo-ai.casbin.com${location.pathname}${location.search}?username=built-in/admin&password=123`); Setting.openLink(`https://demo.casibase.com${location.pathname}${location.search}?username=built-in/admin&password=123`);
}, },
onCancel() {}, onCancel() {},
}); });

View File

@ -15,7 +15,7 @@
package xlsx package xlsx
import ( import (
"github.com/casbin/casibase/util" "github.com/casibase/casibase/util"
"github.com/tealeg/xlsx" "github.com/tealeg/xlsx"
) )