-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f11be44
commit dec2798
Showing
40 changed files
with
858 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package domain | ||
|
||
// 知识库的相关对象 | ||
|
||
// KnowledgeBaseFile 知识库文件 | ||
type KnowledgeBaseFile struct { | ||
Biz string | ||
BizID int64 | ||
// 平台 | ||
Platform string | ||
// 文件名 | ||
Name string | ||
// 文件内容 | ||
Data []byte | ||
// 用途 | ||
Type string | ||
FileID string | ||
KnowledgeBaseID string | ||
} | ||
|
||
const ( | ||
RepositoryBaseTypeRetrieval = "retrieval" | ||
RepositoryBaseTypeFineTune = "finetune" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
internal/ai/internal/integration/llm_knowledge_base_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package integration | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/ecodeclub/webook/internal/ai/internal/domain" | ||
"github.com/ecodeclub/webook/internal/ai/internal/integration/startup" | ||
testioc "github.com/ecodeclub/webook/internal/test/ioc" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestKnowledgeBaseTest(t *testing.T) { | ||
t.Skip("替换api.key运行") | ||
|
||
db := testioc.InitDB() | ||
startup.InitTableOnce(db) | ||
baseSvc := startup.InitKnowledgeBaseSvc(db, "api.key") | ||
testCases := []struct { | ||
name string | ||
file domain.KnowledgeBaseFile | ||
}{ | ||
{ | ||
name: "正常上传", | ||
file: domain.KnowledgeBaseFile{ | ||
Biz: "question", | ||
BizID: 4, | ||
Name: "question4", | ||
Type: domain.RepositoryBaseTypeRetrieval, | ||
Data: []byte("test999999"), | ||
// 这个也要修改 | ||
KnowledgeBaseID: "1863183941318684672", | ||
}, | ||
}, | ||
} | ||
for _, tc := range testCases { | ||
t.Run(tc.name, func(t *testing.T) { | ||
// 执行测试 | ||
err := baseSvc.UploadFile(context.Background(), tc.file) | ||
require.NoError(t, err) | ||
}) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.