Refactor Knowledge struct into shared package
Moved the Knowledge struct and related types to the shared package, updating all references across the codebase. This improves modularity and enables better reuse of the Knowledge type across different components.
This commit is contained in:
@@ -3,19 +3,21 @@ package agents
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"gitea.stevedudenhoeffer.com/steve/answer/pkg/agents/shared"
|
||||
"gitea.stevedudenhoeffer.com/steve/answer/pkg/cache"
|
||||
"gitea.stevedudenhoeffer.com/steve/answer/pkg/extractor"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
func (a Agent) ReadPage(ctx context.Context, u *url.URL, questions []string) (Knowledge, error) {
|
||||
func (a Agent) ReadPage(ctx context.Context, u *url.URL, questions []string) (shared.Knowledge, error) {
|
||||
ar, err := extractArticle(ctx, u)
|
||||
if err != nil {
|
||||
return Knowledge{}, err
|
||||
return shared.Knowledge{}, err
|
||||
}
|
||||
|
||||
if ar.Body == "" {
|
||||
return Knowledge{}, fmt.Errorf("could not extract body from page")
|
||||
return shared.Knowledge{}, fmt.Errorf("could not extract body from page")
|
||||
}
|
||||
|
||||
return a.ExtractKnowledge(ctx, ar.Body, u.String(), questions)
|
||||
|
Reference in New Issue
Block a user