MCPcopy Create free account
hub / github.com/53AI/53AIHub / CreateDefaultLibrary

Function CreateDefaultLibrary

api/model/library.go:473–490  ·  view source on GitHub ↗

CreateDefaultLibrary 为空间创建默认知识库

(spaceID int64, eid int64, creatorID int64)

Source from the content-addressed store, hash-verified

471
472// CreateDefaultLibrary 为空间创建默认知识库
473func CreateDefaultLibrary(spaceID int64, eid int64, creatorID int64) (*Library, error) {
474 library := &Library{
475 Name: "默认知识库",
476 Description: "空间的默认知识库",
477 SpaceID: spaceID,
478 Eid: eid,
479 CreatorID: creatorID,
480 LibraryKind: LIBRARY_KIND_REGULAR,
481 Status: LIBRARY_STATUS_ACTIVE,
482 Sort: 0,
483 }
484
485 if err := library.Save(); err != nil {
486 return nil, err
487 }
488
489 return library, nil
490}
491
492// GetDefaultLibrary 获取空间的默认知识库
493func GetDefaultLibrary(eid int64, spaceID int64) (*Library, error) {

Callers

nothing calls this directly

Calls 1

SaveMethod · 0.95

Tested by

no test coverage detected