Fix chat store API and display middleware
This commit is contained in:
parent
5d377cd21b
commit
77c1921c77
2 changed files with 7 additions and 11 deletions
|
|
@ -40,7 +40,7 @@ type Options struct {
|
|||
type Service struct {
|
||||
*core.ServiceRuntime[Options]
|
||||
options Options
|
||||
store *store.KeyValueStore
|
||||
store *store.Store
|
||||
httpClient *http.Client
|
||||
toolExecutor ToolExecutor
|
||||
toolHandler *ToolCallHandler
|
||||
|
|
@ -155,7 +155,7 @@ func (s *Service) OnStartup(_ context.Context) core.Result {
|
|||
return core.Result{Value: err, OK: false}
|
||||
}
|
||||
|
||||
keyValueStore, err := store.New(store.Options{Path: s.options.StorePath})
|
||||
keyValueStore, err := store.New(s.options.StorePath)
|
||||
if err != nil {
|
||||
return core.Result{Value: err, OK: false}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package display
|
|||
import (
|
||||
"context"
|
||||
"html"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
|
|
@ -17,9 +16,9 @@ import (
|
|||
|
||||
type SchemeHandler func(context.Context, string, url.Values) core.Result
|
||||
|
||||
type assetHandlerFunc func(w http.ResponseWriter, r *http.Request)
|
||||
type assetHandlerFunc func(w application.ResponseWriter, r *application.Request)
|
||||
|
||||
func (f assetHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
func (f assetHandlerFunc) ServeHTTP(w application.ResponseWriter, r *application.Request) {
|
||||
f(w, r)
|
||||
}
|
||||
|
||||
|
|
@ -453,12 +452,9 @@ func coalesce(values ...string) string {
|
|||
}
|
||||
|
||||
func (s *Service) AssetMiddleware() application.Middleware {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return assetHandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
rawURL := ""
|
||||
if r.URL != nil {
|
||||
rawURL = r.URL.String()
|
||||
}
|
||||
return func(next application.Handler) application.Handler {
|
||||
return assetHandlerFunc(func(w application.ResponseWriter, r *application.Request) {
|
||||
rawURL := r.URL
|
||||
if strings.HasPrefix(strings.ToLower(strings.TrimSpace(rawURL)), "core://") {
|
||||
result := s.ResolveScheme(context.Background(), rawURL)
|
||||
if !result.OK {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue