mirror of
https://github.com/karust/openserp.git
synced 2026-08-15 13:14:16 +08:00
cleanup
This commit is contained in:
@@ -426,14 +426,14 @@ type batchExtractPayload struct {
|
||||
Mode string `json:"mode"`
|
||||
}
|
||||
|
||||
// batchExtractItem is the WebUI-compatible response item per URL.
|
||||
// batchExtractItem is a response item for a single extracted URL, using
|
||||
// page_content/metadata keys
|
||||
type batchExtractItem struct {
|
||||
PageContent string `json:"page_content"`
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
}
|
||||
|
||||
func (s *Server) handleBatchExtract(c *fiber.Ctx) error {
|
||||
startedAt := time.Now()
|
||||
requestCtx := withRequestUsage(c.UserContext(), "extract-batch")
|
||||
c.SetUserContext(requestCtx)
|
||||
defer setNetworkBytesHeader(c, requestCtx)
|
||||
@@ -545,6 +545,5 @@ func (s *Server) handleBatchExtract(c *fiber.Ctx) error {
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
_ = startedAt
|
||||
return c.JSON(results)
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ func TestValidateExtractTargetURLNormalizesBarePublicIP(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBatchExtractReturnsWebUIFormat(t *testing.T) {
|
||||
func TestBatchExtractSingleURL(t *testing.T) {
|
||||
target := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, _ = w.Write([]byte(`<html><body><article><h1>Test Page</h1><p>This is a test page with enough content to pass the minimum runes threshold for extraction in batch mode.</p></article></body></html>`))
|
||||
|
||||
Reference in New Issue
Block a user