refactor(api): hyphenate the remaining route path segments (#21730)

This commit is contained in:
Zhichang Yu authored and GitHub committed 2026-10-30 10:34:18 +08:00
1 parent 2fd857b128
commit 327cdb2d80
13 files changed
+55 -55

No files matched your search

+1 -1
View File
@@ -73,7 +73,7 @@ func (r *Router) Setup(engine *gin.Engine) {
// Service management
protected.GET("/services", r.handler.GetServices)
protected.GET("/service_types/:service_type", r.handler.GetServicesByType)
protected.GET("/service-types/:service_type", r.handler.GetServicesByType)
protected.GET("/services/:service_name", r.handler.GetService)
protected.DELETE("/services/:service_name", r.handler.ShutdownService)
protected.PUT("/services/:service_name", r.handler.RestartService)
+6 -6
View File
@@ -978,7 +978,7 @@ func (c *CLI) DevCreateChunkStoreCommand(commandCount int, cmd *Command) (Respon
"vector_size": vectorSize,
}
resp, err := httpClient.Request(commandCount, "POST", "/tenant/chunk_store", httpClient.AuthKind(), nil, payload)
resp, err := httpClient.Request(commandCount, "POST", "/tenant/chunk-store", httpClient.AuthKind(), nil, payload)
if err != nil {
return nil, fmt.Errorf("failed to create chunk store: %w", err)
}
@@ -1030,7 +1030,7 @@ func (c *CLI) DevDropChunkStoreCommand(commandCount int, cmd *Command) (Response
"kb_id": datasetID,
}
resp, err := httpClient.Request(commandCount, "DELETE", "/tenant/chunk_store", httpClient.AuthKind(), nil, payload)
resp, err := httpClient.Request(commandCount, "DELETE", "/tenant/chunk-store", httpClient.AuthKind(), nil, payload)
if err != nil {
return nil, fmt.Errorf("failed to drop chunk store: %w", err)
}
@@ -1067,7 +1067,7 @@ func (c *CLI) DevCreateMetadataStoreCommand(commandCount int, cmd *Command) (Res
return nil, err
}
resp, err := httpClient.Request(commandCount, "POST", "/tenant/metadata_store", httpClient.AuthKind(), nil, nil)
resp, err := httpClient.Request(commandCount, "POST", "/tenant/metadata-store", httpClient.AuthKind(), nil, nil)
if err != nil {
return nil, fmt.Errorf("failed to create metadata store: %w", err)
}
@@ -1104,7 +1104,7 @@ func (c *CLI) DevDropMetadataStoreCommand(commandCount int, cmd *Command) (Respo
return nil, err
}
resp, err := httpClient.Request(commandCount, "DELETE", "/tenant/metadata_store", httpClient.AuthKind(), nil, nil)
resp, err := httpClient.Request(commandCount, "DELETE", "/tenant/metadata-store", httpClient.AuthKind(), nil, nil)
if err != nil {
return nil, fmt.Errorf("failed to drop metadata store: %w", err)
}
@@ -1787,7 +1787,7 @@ func (c *CLI) APIChatToModelCommand(commandCount int, cmd *Command) (ResponseIf,
effort := cmd.Params["effort"].(string)
verbosity := cmd.Params["verbosity"].(string)
url := "/chat/to_model"
url := "/chat/to-model"
payload := map[string]interface{}{
"messages": formattedMessages,
@@ -3129,7 +3129,7 @@ func (c *CLI) APIListSyncLogsCommand(commandCount int, cmd *Command) (ResponseIf
datasetID = id
}
url := "/connectors/sync_logs"
url := "/connectors/sync-logs"
query := netUrl.Values{}
if datasetID != "" {
query.Set("dataset_id", datasetID)
+1 -1
View File
@@ -1532,7 +1532,7 @@ func (h *AgentHandler) AgentChatCompletions(c *gin.Context) {
common.SuccessWithData(c, result, "success")
}
// TestDBConnection POST /api/v1/agents/test_db_connection
// TestDBConnection POST /api/v1/agents/test-db-connection
func (h *AgentHandler) TestDBConnection(c *gin.Context) {
user, code, msg := GetUser(c)
if code != common.CodeSuccess {
+2 -2
View File
@@ -247,7 +247,7 @@ func (h *ConnectorHandler) ListLogs(c *gin.Context) {
common.SuccessWithData(c, gin.H{"total": total, "logs": logs}, "success")
}
// ListSyncLogs handles GET /api/v1/connectors/sync_logs.
// ListSyncLogs handles GET /api/v1/connectors/sync-logs.
// Lists sync logs for the current user; when dataset_id is provided, only
// the logs of that dataset are returned.
// @Summary list sync logs
@@ -256,7 +256,7 @@ func (h *ConnectorHandler) ListLogs(c *gin.Context) {
// @Accept json
// @Produce json
// @Success 200 {object} map[string]interface{}
// @Router /api/v1/connectors/sync_logs [get]
// @Router /api/v1/connectors/sync-logs [get]
func (h *ConnectorHandler) ListSyncLogs(c *gin.Context) {
user, errorCode, errorMessage := GetUser(c)
if errorCode != common.CodeSuccess {
+2 -2
View File
@@ -687,13 +687,13 @@ func TestConnectorHandlerListSyncLogs(t *testing.T) {
capture: capture,
}}
router := gin.New()
router.GET("/api/v1/connectors/sync_logs", func(c *gin.Context) {
router.GET("/api/v1/connectors/sync-logs", func(c *gin.Context) {
c.Set("user", &entity.User{ID: "tenant-1"})
h.ListSyncLogs(c)
})
resp := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/api/v1/connectors/sync_logs"+tt.query, nil)
req := httptest.NewRequest(http.MethodGet, "/api/v1/connectors/sync-logs"+tt.query, nil)
router.ServeHTTP(resp, req)
var body map[string]interface{}
+7 -7
View File
@@ -48,7 +48,7 @@ type SearchBotMindMapRequest struct {
SearchID string `json:"search_id,omitempty"`
}
// SearchBotRetrievalTestRequest is the request body for POST /api/v1/searchbots/retrieval_test.
// SearchBotRetrievalTestRequest is the request body for POST /api/v1/searchbots/retrieval-test.
type SearchBotRetrievalTestRequest struct {
KbIDs common.StringSlice `json:"kb_ids" binding:"required"`
Question string `json:"question" binding:"required"`
@@ -88,7 +88,7 @@ func (r *SearchBotRetrievalTestRequest) UnmarshalJSON(data []byte) error {
return nil
}
// SearchBotRequest is the request body for POST /api/v1/searchbots/related_questions.
// SearchBotRequest is the request body for POST /api/v1/searchbots/related-questions.
// Question is validated manually below so the error message follows the
// established API contract instead of the Gin validator format.
type SearchBotRequest struct {
@@ -98,8 +98,8 @@ type SearchBotRequest struct {
// SearchBotHandler handles searchbot endpoints:
//
// POST /api/v1/searchbots/related_questions
// POST /api/v1/searchbots/retrieval_test
// POST /api/v1/searchbots/related-questions
// POST /api/v1/searchbots/retrieval-test
// POST /api/v1/searchbots/ask
// POST /api/v1/searchbots/mindmap
type SearchBotHandler struct {
@@ -127,7 +127,7 @@ func (h *SearchBotHandler) SetAskService(svc *service.AskService) { h.askSvc = s
// @Produce json
// @Param request body SearchBotRequest true "Request body"
// @Success 200 {object} map[string]interface{}
// @Router /api/v1/searchbots/related_questions [post]
// @Router /api/v1/searchbots/related-questions [post]
func (h *SearchBotHandler) Handle(c *gin.Context) {
ctx := c.Request.Context()
user, errorCode, errorMessage := GetUser(c)
@@ -166,7 +166,7 @@ func (h *SearchBotHandler) Handle(c *gin.Context) {
// @Tags searchBots
// @Param request body SearchBotRetrievalTestRequest true "Retrieval test parameters"
// @Success 200 {object} map[string]interface{}
// @Router /api/v1/searchbots/retrieval_test [post]
// @Router /api/v1/searchbots/retrieval-test [post]
func (h *SearchBotHandler) RetrievalTest(c *gin.Context) {
user, errorCode, errorMessage := GetUser(c)
if errorCode != common.CodeSuccess {
@@ -562,7 +562,7 @@ func toRetrievalServiceRequest(h *SearchBotRetrievalTestRequest) *service.Retrie
}
// applyRetrievalDefaults fills in default values for optional fields,
// matching Python bot_api.py retrieval_test endpoint.
// matching the Python bot_api.py retrieval_test endpoint.
//
// similarity_threshold, vector_similarity_weight and top_k are left nil:
// ChunkService.RetrievalTest resolves them against the search app's saved
+17 -17
View File
@@ -62,7 +62,7 @@ func setupSearchbotsTest(userID string) (*SearchBotHandler, *mockChunkService, *
r.Use(func(c *gin.Context) {
c.Set("user", &entity.User{ID: userID})
})
r.POST("/api/v1/searchbots/retrieval_test", h.RetrievalTest)
r.POST("/api/v1/searchbots/retrieval-test", h.RetrievalTest)
return h, mockSvc, r
}
@@ -71,7 +71,7 @@ func TestSearchBotsRetrieval_Basic(t *testing.T) {
body := `{"kb_ids": ["kb1"], "question": "test question"}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
@@ -107,7 +107,7 @@ func TestSearchBotsRetrieval_MissingKbID(t *testing.T) {
_, _, r := setupSearchbotsTest("user1")
body := `{"question": "test"}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
@@ -130,7 +130,7 @@ func TestSearchBotsRetrieval_MissingQuestion(t *testing.T) {
_, _, r := setupSearchbotsTest("user1")
body := `{"kb_ids": ["kb1"]}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
@@ -153,10 +153,10 @@ func TestSearchBotsRetrieval_NoAuth(t *testing.T) {
h := NewSearchBotHandler(nil, nil, nil, &mockChunkService{})
gin.SetMode(gin.TestMode)
r := gin.New()
r.POST("/api/v1/searchbots/retrieval_test", h.RetrievalTest)
r.POST("/api/v1/searchbots/retrieval-test", h.RetrievalTest)
w := httptest.NewRecorder()
body := `{"kb_ids": ["kb1"], "question": "test"}`
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
if w.Code != http.StatusUnauthorized {
@@ -173,7 +173,7 @@ func TestSearchBotsRetrieval_ServiceError(t *testing.T) {
}
w := httptest.NewRecorder()
body := `{"kb_ids": ["kb1"], "question": "test"}`
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
if w.Code != http.StatusOK {
@@ -197,7 +197,7 @@ func TestSearchBotsRetrieval_KbIDSingleString(t *testing.T) {
body := `{"kb_ids": "kb1", "question": "test"}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
@@ -218,7 +218,7 @@ func TestSearchBotsRetrieval_KbIDArray(t *testing.T) {
body := `{"kb_ids": ["a","b"], "question": "test"}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
@@ -236,7 +236,7 @@ func TestSearchBotsRetrieval_KbIDArray(t *testing.T) {
func TestSearchBotsRetrieval_InvalidJSON(t *testing.T) {
_, _, r := setupSearchbotsTest("user1")
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader("{invalid}"))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader("{invalid}"))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
@@ -248,7 +248,7 @@ func TestSearchBotsRetrieval_EmptyStringKbID(t *testing.T) {
_, _, r := setupSearchbotsTest("user1")
body := `{"kb_ids": "", "question": "test"}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
@@ -267,7 +267,7 @@ func TestSearchBotsRetrieval_WhitespaceOnlyKbID(t *testing.T) {
_, _, r := setupSearchbotsTest("user1")
body := `{"kb_ids": " ", "question": "test"}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
@@ -291,7 +291,7 @@ func TestSearchBotsRetrieval_DefaultsApplied(t *testing.T) {
body := `{"kb_ids": ["kb1"], "question": "does this default?"}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
@@ -330,7 +330,7 @@ func TestSearchBotsRetrieval_TopKZero(t *testing.T) {
_, _, r := setupSearchbotsTest("user1")
body := `{"kb_ids": ["kb1"], "question": "test", "top_k": 0}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
@@ -349,7 +349,7 @@ func TestSearchBotsRetrieval_TopKNegative(t *testing.T) {
_, _, r := setupSearchbotsTest("user1")
body := `{"kb_ids": ["kb1"], "question": "test", "top_k": -1}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
@@ -393,7 +393,7 @@ func TestSearchBotsRetrieval_EmptyQuestion(t *testing.T) {
_, _, r := setupSearchbotsTest("user1")
body := `{"kb_ids": ["kb1"], "question": ""}`
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval_test", strings.NewReader(body))
req, _ := http.NewRequest("POST", "/api/v1/searchbots/retrieval-test", strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
@@ -409,7 +409,7 @@ func setupSearchBotRequest(body string) (*gin.Context, *httptest.ResponseRecorde
gin.SetMode(gin.TestMode)
w := httptest.NewRecorder()
c, _ := gin.CreateTestContext(w)
c.Request = httptest.NewRequest("POST", "/api/v1/searchbots/related_questions",
c.Request = httptest.NewRequest("POST", "/api/v1/searchbots/related-questions",
strings.NewReader(body))
c.Request.Header.Set("Content-Type", "application/json")
c.Set("user", &entity.User{ID: "user-1"})
+4 -4
View File
@@ -186,7 +186,7 @@ func (h *TenantHandler) TenantList(c *gin.Context) {
// @Produce json
// @Security ApiKeyAuth
// @Success 200 {object} map[string]interface{}
// @Router /v1/tenant/metadata_store [post]
// @Router /v1/tenant/metadata-store [post]
func (h *TenantHandler) CreateMetadataStore(c *gin.Context) {
user, errorCode, errorMessage := GetUser(c)
if errorCode != common.CodeSuccess {
@@ -214,7 +214,7 @@ func (h *TenantHandler) CreateMetadataStore(c *gin.Context) {
// @Produce json
// @Security ApiKeyAuth
// @Success 200 {object} map[string]interface{}
// @Router /v1/tenant/metadata_store [delete]
// @Router /v1/tenant/metadata-store [delete]
func (h *TenantHandler) DeleteMetadataStore(c *gin.Context) {
user, errorCode, errorMessage := GetUser(c)
if errorCode != common.CodeSuccess {
@@ -250,7 +250,7 @@ type CreateChunkTableRequest struct {
// @Security ApiKeyAuth
// @Param request body CreateChunkTableRequest true "create chunk store request"
// @Success 200 {object} map[string]interface{}
// @Router /v1/tenant/chunk_store [post]
// @Router /v1/tenant/chunk-store [post]
func (h *TenantHandler) CreateChunkStore(c *gin.Context) {
user, errorCode, errorMessage := GetUser(c)
if errorCode != common.CodeSuccess {
@@ -298,7 +298,7 @@ type DeleteChunkTableRequest struct {
// @Security ApiKeyAuth
// @Param request body DeleteChunkTableRequest true "delete chunk store request"
// @Success 200 {object} map[string]interface{}
// @Router /v1/tenant/chunk_store [delete]
// @Router /v1/tenant/chunk-store [delete]
func (h *TenantHandler) DeleteChunkStore(c *gin.Context) {
user, errorCode, errorMessage := GetUser(c)
if errorCode != common.CodeSuccess {
+1 -1
View File
@@ -93,7 +93,7 @@ func RegisterAgentRoutes(g *gin.RouterGroup, h *handler.AgentHandler) {
// (api/apps/restful_apis/agent_api.py) has since removed the route.
// See plan: .claude/plans/agent-api-gaps-go-port.md §Gap E.
g.POST("/chat/completions", h.AgentChatCompletions)
g.POST("/test_db_connection", h.TestDBConnection)
g.POST("/test-db-connection", h.TestDBConnection)
}
// RegisterPublicAgentWebhookRoutes registers external webhook triggers on
+8 -8
View File
@@ -203,8 +203,8 @@ func (r *Router) Setup(engine *gin.Engine) {
apiBetaAuth.Use(r.authHandler.BetaAuthMiddleware())
{
searchBotGroup := apiBetaAuth.Group("/searchbots")
searchBotGroup.POST("/related_questions", r.searchBotHandler.Handle)
searchBotGroup.POST("/retrieval_test", r.searchBotHandler.RetrievalTest)
searchBotGroup.POST("/related-questions", r.searchBotHandler.Handle)
searchBotGroup.POST("/retrieval-test", r.searchBotHandler.RetrievalTest)
searchBotGroup.POST("/ask", r.searchBotHandler.Ask)
searchBotGroup.POST("/mindmap", r.searchBotHandler.MindMap)
@@ -286,10 +286,10 @@ func (r *Router) Setup(engine *gin.Engine) {
// Tenant routes (per-tenant resources)
tenant := v1.Group("/tenant")
{
tenant.POST("/chunk_store", r.tenantHandler.CreateChunkStore) // Internal API only for GO
tenant.DELETE("/chunk_store", r.tenantHandler.DeleteChunkStore) // Internal API only for GO
tenant.POST("/metadata_store", r.tenantHandler.CreateMetadataStore) // Internal API only for GO
tenant.DELETE("/metadata_store", r.tenantHandler.DeleteMetadataStore) // Internal API only for GO
tenant.POST("/chunk-store", r.tenantHandler.CreateChunkStore) // Internal API only for GO
tenant.DELETE("/chunk-store", r.tenantHandler.DeleteChunkStore) // Internal API only for GO
tenant.POST("/metadata-store", r.tenantHandler.CreateMetadataStore) // Internal API only for GO
tenant.DELETE("/metadata-store", r.tenantHandler.DeleteMetadataStore) // Internal API only for GO
}
// Document routes
@@ -558,7 +558,7 @@ func (r *Router) Setup(engine *gin.Engine) {
// command is for CLI
command := v1
{
command.POST("/chat/to_model", r.providerHandler.ChatToModel)
command.POST("/chat/to-model", r.providerHandler.ChatToModel)
command.POST("/embeddings", r.providerHandler.EmbedText)
command.POST("/rerank", r.providerHandler.RerankDocument)
command.POST("/audio/transcriptions", r.providerHandler.TranscribeAudio)
@@ -625,7 +625,7 @@ func (r *Router) Setup(engine *gin.Engine) {
{
connectors.GET("", r.connectorHandler.ListConnectors)
connectors.POST("", r.connectorHandler.CreateConnector)
connectors.GET("/sync_logs", r.connectorHandler.ListSyncLogs)
connectors.GET("/sync-logs", r.connectorHandler.ListSyncLogs)
connectors.POST("/google/oauth/web/start", r.connectorHandler.StartGoogleWebOAuth)
connectors.POST("/google/oauth/web/result", r.connectorHandler.PollGoogleWebOAuthResult)
connectors.POST("/box/oauth/web/start", r.connectorHandler.StartBoxWebOAuth)
+2 -2
View File
@@ -427,7 +427,7 @@ func TestRESTAgentSupport(t *testing.T) {
}
restCode(t, restCall(t, TestConfig, http.MethodGet, "/agents/"+uniqueName("missing")+"/webhook/logs", nil, nil), http.StatusOK, 102)
for _, body := range []apiObject{{}, {"db_type": "mysql"}, {"db_type": "mysql", "host": "localhost", "port": 3306}} {
result := restCall(t, TestConfig, http.MethodPost, "/agents/test_db_connection", body, nil)
result := restCall(t, TestConfig, http.MethodPost, "/agents/test-db-connection", body, nil)
restCode(t, result, http.StatusOK, 101)
if message, _ := result.JSON["message"].(string); !strings.Contains(message, "required argument are missing") {
t.Fatalf("missing DB fields did not produce validation error: %v", result.JSON)
@@ -459,7 +459,7 @@ func TestRESTAgentAuthorization(t *testing.T) {
{http.MethodDelete, "/agents/" + id + "/sessions/" + sessionID, nil},
{http.MethodGet, "/agents/" + id + "/logs/missing", nil},
{http.MethodGet, "/agents/" + id + "/webhook/logs", nil},
{http.MethodPost, "/agents/test_db_connection", apiObject{}},
{http.MethodPost, "/agents/test-db-connection", apiObject{}},
{http.MethodPost, "/agents/chat/completions", apiObject{"agent_id": id, "query": "denied"}},
} {
t.Run(tc.method+"_"+tc.path, func(t *testing.T) {
+1 -1
View File
@@ -371,7 +371,7 @@ func TestRESTRetrievalChunkDeletionConsistency(t *testing.T) {
}
func TestRESTRelatedQuestions(t *testing.T) {
path := "/searchbots/related_questions"
path := "/searchbots/related-questions"
for _, token := range []string{"", "invalid-api-key"} {
config := *TestConfig
config.APIKey = token
+3 -3
View File
@@ -352,7 +352,7 @@ const apiEndpoints = {
deleteAgent: (agentId: string) => `${restAPIv1}/agents/${agentId}`,
agentChatCompletion: `${restAPIv1}/agents/chat/completions`,
resetAgent: (agentId: string) => `${restAPIv1}/agents/${agentId}/reset`,
testDbConnect: `${restAPIv1}/agents/test_db_connection`,
testDbConnect: `${restAPIv1}/agents/test-db-connection`,
getInputElements: `${webAPI}/canvas/input_elements`,
debug: (agentId: string, componentId: string) =>
`${restAPIv1}/agents/${agentId}/components/${componentId}/debug`,
@@ -448,8 +448,8 @@ const apiEndpoints = {
`${restAPIv1}/searches/${params.search_id}`,
askShare: `${restAPIv1}/searchbots/ask`,
mindmapShare: `${restAPIv1}/searchbots/mindmap`,
getRelatedQuestionsShare: `${restAPIv1}/searchbots/related_questions`,
retrievalTestShare: `${restAPIv1}/searchbots/retrieval_test`,
getRelatedQuestionsShare: `${restAPIv1}/searchbots/related-questions`,
retrievalTestShare: `${restAPIv1}/searchbots/retrieval-test`,
// memory
createMemory: `${restAPIv1}/memories`,