Skip to content

Commit f82d406

Browse files
authored
Merge pull request #1096 from trheyi/main
Refactor provider schemas to utilize bindata for enhanced localizatio…
2 parents f70f675 + eb1bf43 commit f82d406

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4970
-208
lines changed

data/bindata.go

Lines changed: 581 additions & 189 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kb/providers/converters/mcp.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/yaoapp/gou/graphrag/converter"
77
"github.com/yaoapp/gou/graphrag/types"
8+
"github.com/yaoapp/yao/kb/providers/factory"
89
kbtypes "github.com/yaoapp/yao/kb/types"
910
)
1011

@@ -128,5 +129,5 @@ func (mcp *MCP) AutoDetect(filename, contentTypes string) (bool, int, error) {
128129

129130
// Schema returns the schema for the MCP converter
130131
func (mcp *MCP) Schema(provider *kbtypes.Provider, locale string) (*kbtypes.ProviderSchema, error) {
131-
return nil, nil
132+
return factory.GetSchemaFromBindata(factory.ProviderTypeConverter, "mcp", locale)
132133
}

kb/providers/converters/ocr.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/yaoapp/gou/graphrag/converter"
88
"github.com/yaoapp/gou/graphrag/types"
99
"github.com/yaoapp/gou/pdf"
10+
"github.com/yaoapp/yao/kb/providers/factory"
1011
kbtypes "github.com/yaoapp/yao/kb/types"
1112
)
1213

@@ -169,5 +170,5 @@ func (ocr *OCR) AutoDetect(filename, contentTypes string) (bool, int, error) {
169170

170171
// Schema returns the schema for the OCR converter
171172
func (ocr *OCR) Schema(provider *kbtypes.Provider, locale string) (*kbtypes.ProviderSchema, error) {
172-
return nil, nil
173+
return factory.GetSchemaFromBindata(factory.ProviderTypeConverter, "ocr", locale)
173174
}

kb/providers/converters/office.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/yaoapp/gou/graphrag/converter"
88
"github.com/yaoapp/gou/graphrag/types"
9+
"github.com/yaoapp/yao/kb/providers/factory"
910
kbtypes "github.com/yaoapp/yao/kb/types"
1011
)
1112

@@ -109,5 +110,5 @@ func (office *Office) AutoDetect(filename, contentTypes string) (bool, int, erro
109110

110111
// Schema returns the schema for the Office converter
111112
func (office *Office) Schema(provider *kbtypes.Provider, locale string) (*kbtypes.ProviderSchema, error) {
112-
return nil, nil
113+
return factory.GetSchemaFromBindata(factory.ProviderTypeConverter, "office", locale)
113114
}

kb/providers/converters/utf8.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/yaoapp/gou/graphrag/converter"
77
"github.com/yaoapp/gou/graphrag/types"
8+
"github.com/yaoapp/yao/kb/providers/factory"
89
kbtypes "github.com/yaoapp/yao/kb/types"
910
)
1011

@@ -44,5 +45,5 @@ func (utf8 *UTF8) AutoDetect(filename, contentTypes string) (bool, int, error) {
4445

4546
// Schema returns the schema for the UTF8 converter
4647
func (utf8 *UTF8) Schema(provider *kbtypes.Provider, locale string) (*kbtypes.ProviderSchema, error) {
47-
return nil, nil
48+
return factory.GetSchemaFromBindata(factory.ProviderTypeConverter, "utf8", locale)
4849
}

kb/providers/converters/video.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/yaoapp/gou/graphrag/converter"
88
"github.com/yaoapp/gou/graphrag/types"
9+
"github.com/yaoapp/yao/kb/providers/factory"
910
kbtypes "github.com/yaoapp/yao/kb/types"
1011
)
1112

@@ -190,5 +191,5 @@ func (video *Video) AutoDetect(filename, contentTypes string) (bool, int, error)
190191

191192
// Schema returns the schema for the Video converter
192193
func (video *Video) Schema(provider *kbtypes.Provider, locale string) (*kbtypes.ProviderSchema, error) {
193-
return nil, nil
194+
return factory.GetSchemaFromBindata(factory.ProviderTypeConverter, "video", locale)
194195
}

kb/providers/converters/vision.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/yaoapp/gou/graphrag/converter"
77
"github.com/yaoapp/gou/graphrag/types"
8+
"github.com/yaoapp/yao/kb/providers/factory"
89
kbtypes "github.com/yaoapp/yao/kb/types"
910
)
1011

@@ -94,5 +95,5 @@ func (vision *Vision) AutoDetect(filename, contentTypes string) (bool, int, erro
9495

9596
// Schema returns the schema for the Vision converter
9697
func (vision *Vision) Schema(provider *kbtypes.Provider, locale string) (*kbtypes.ProviderSchema, error) {
97-
return nil, nil
98+
return factory.GetSchemaFromBindata(factory.ProviderTypeConverter, "vision", locale)
9899
}

kb/providers/converters/whisper.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/yaoapp/gou/graphrag/converter"
77
"github.com/yaoapp/gou/graphrag/types"
8+
"github.com/yaoapp/yao/kb/providers/factory"
89
kbtypes "github.com/yaoapp/yao/kb/types"
910
)
1011

@@ -144,5 +145,5 @@ func (whisper *Whisper) AutoDetect(filename, contentTypes string) (bool, int, er
144145

145146
// Schema returns the schema for the Whisper converter
146147
func (whisper *Whisper) Schema(provider *kbtypes.Provider, locale string) (*kbtypes.ProviderSchema, error) {
147-
return nil, nil
148+
return factory.GetSchemaFromBindata(factory.ProviderTypeConverter, "whisper", locale)
148149
}

kb/providers/embedding.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (o *OpenAI) Make(option *kbtypes.ProviderOption) (types.Embedding, error) {
7171

7272
// Schema returns the schema for the OpenAI embedding provider
7373
func (o *OpenAI) Schema(provider *kbtypes.Provider, locale string) (*kbtypes.ProviderSchema, error) {
74-
return nil, nil
74+
return factory.GetSchemaFromBindata(factory.ProviderTypeEmbedding, "openai", locale)
7575
}
7676

7777
// === Fastembed ===
@@ -142,5 +142,5 @@ func (f *Fastembed) Make(option *kbtypes.ProviderOption) (types.Embedding, error
142142

143143
// Schema returns the schema for the Fastembed embedding provider
144144
func (f *Fastembed) Schema(provider *kbtypes.Provider, locale string) (*kbtypes.ProviderSchema, error) {
145-
return nil, nil
145+
return factory.GetSchemaFromBindata(factory.ProviderTypeEmbedding, "fastembed", locale)
146146
}

kb/providers/extractor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,5 @@ func (e *ExtractorOpenAI) Make(option *kbtypes.ProviderOption) (types.Extraction
129129

130130
// Schema returns the schema for the OpenAI extractor provider
131131
func (e *ExtractorOpenAI) Schema(provider *kbtypes.Provider, locale string) (*kbtypes.ProviderSchema, error) {
132-
return nil, nil
132+
return factory.GetSchemaFromBindata(factory.ProviderTypeExtractor, "openai", locale)
133133
}

0 commit comments

Comments
 (0)