Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit089dba5

Browse files
committed
chore: graduate aibridge API out of experimental
Signed-off-by: Danny Kopping <danny@coder.com>
1 parentc11db03 commit089dba5

File tree

7 files changed

+114
-122
lines changed

7 files changed

+114
-122
lines changed

‎coderd/apidoc/docs.go‎

Lines changed: 51 additions & 51 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json‎

Lines changed: 47 additions & 47 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎codersdk/aibridge.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ func (f AIBridgeListInterceptionsFilter) asRequestOption() RequestOption {
113113

114114
// AIBridgeListInterceptions returns AIBridge interceptions with the given
115115
// filter.
116-
func (c*ExperimentalClient)AIBridgeListInterceptions(ctx context.Context,filterAIBridgeListInterceptionsFilter) (AIBridgeListInterceptionsResponse,error) {
117-
res,err:=c.Request(ctx,http.MethodGet,"/api/experimental/aibridge/interceptions",nil,filter.asRequestOption(),filter.Pagination.asRequestOption(),filter.Pagination.asRequestOption())
116+
func (c*Client)AIBridgeListInterceptions(ctx context.Context,filterAIBridgeListInterceptionsFilter) (AIBridgeListInterceptionsResponse,error) {
117+
res,err:=c.Request(ctx,http.MethodGet,"/api/v2/aibridge/interceptions",nil,filter.asRequestOption(),filter.Pagination.asRequestOption(),filter.Pagination.asRequestOption())
118118
iferr!=nil {
119119
returnAIBridgeListInterceptionsResponse{},err
120120
}

‎enterprise/aibridged/aibridged.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var _ io.Closer = &Server{}
1919

2020
// Server provides the AI Bridge functionality.
2121
// It is responsible for:
22-
// - receiving requests on /api/experimental/aibridged/* // TODO: update endpoint once out of experimental
22+
// - receiving requests on /api/v2/aibridged/*
2323
// - manipulating the requests
2424
// - relaying requests to upstream AI services and relaying responses to caller
2525
//

‎enterprise/coderd/aibridge.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const (
3636
// @Param after_id query string false "Cursor pagination after ID (cannot be used with offset)"
3737
// @Param offset query int false "Offset pagination (cannot be used with after_id)"
3838
// @Success 200 {object} codersdk.AIBridgeListInterceptionsResponse
39-
// @Router /api/experimental/aibridge/interceptions [get]
39+
// @Router /api/v2/aibridge/interceptions [get]
4040
func (api*API)aiBridgeListInterceptions(rw http.ResponseWriter,r*http.Request) {
4141
ctx:=r.Context()
4242
apiKey:=httpmw.APIKey(r)

‎enterprise/coderd/aibridge_test.go‎

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ func TestAIBridgeListInterceptions(t *testing.T) {
3636
Features: license.Features{},
3737
},
3838
})
39-
experimentalClient:=codersdk.NewExperimentalClient(client)
4039

4140
ctx:=testutil.Context(t,testutil.WaitLong)
42-
_,err:=experimentalClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
41+
_,err:=client.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
4342
varsdkErr*codersdk.Error
4443
require.ErrorAs(t,err,&sdkErr)
4544
require.Equal(t,http.StatusForbidden,sdkErr.StatusCode())
@@ -59,9 +58,8 @@ func TestAIBridgeListInterceptions(t *testing.T) {
5958
},
6059
},
6160
})
62-
experimentalClient:=codersdk.NewExperimentalClient(client)
6361
ctx:=testutil.Context(t,testutil.WaitLong)
64-
res,err:=experimentalClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
62+
res,err:=client.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
6563
require.NoError(t,err)
6664
require.Empty(t,res.Results)
6765
})
@@ -79,7 +77,6 @@ func TestAIBridgeListInterceptions(t *testing.T) {
7977
},
8078
},
8179
})
82-
experimentalClient:=codersdk.NewExperimentalClient(client)
8380
ctx:=testutil.Context(t,testutil.WaitLong)
8481

8582
user1,err:=client.User(ctx,codersdk.Me)
@@ -140,7 +137,7 @@ func TestAIBridgeListInterceptions(t *testing.T) {
140137
i1SDK:=db2sdk.AIBridgeInterception(i1,user1Visible, []database.AIBridgeTokenUsage{i1tok2,i1tok1}, []database.AIBridgeUserPrompt{i1up2,i1up1}, []database.AIBridgeToolUsage{i1tool2,i1tool1})
141138
i2SDK:=db2sdk.AIBridgeInterception(i2,user2Visible,nil,nil,nil)
142139

143-
res,err:=experimentalClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
140+
res,err:=client.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
144141
require.NoError(t,err)
145142
require.Len(t,res.Results,2)
146143
require.Equal(t,i2SDK.ID,res.Results[0].ID)
@@ -190,7 +187,6 @@ func TestAIBridgeListInterceptions(t *testing.T) {
190187
},
191188
},
192189
})
193-
experimentalClient:=codersdk.NewExperimentalClient(client)
194190
ctx:=testutil.Context(t,testutil.WaitLong)
195191

196192
allInterceptionIDs:=make([]uuid.UUID,0,20)
@@ -221,7 +217,7 @@ func TestAIBridgeListInterceptions(t *testing.T) {
221217
}
222218

223219
// Try to fetch with an invalid limit.
224-
res,err:=experimentalClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{
220+
res,err:=client.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{
225221
Pagination: codersdk.Pagination{
226222
Limit:1001,
227223
},
@@ -232,7 +228,7 @@ func TestAIBridgeListInterceptions(t *testing.T) {
232228
require.Empty(t,res.Results)
233229

234230
// Try to fetch with both after_id and offset pagination.
235-
res,err=experimentalClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{
231+
res,err=client.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{
236232
Pagination: codersdk.Pagination{
237233
AfterID:allInterceptionIDs[0],
238234
Offset:1,
@@ -265,7 +261,7 @@ func TestAIBridgeListInterceptions(t *testing.T) {
265261
}else {
266262
pagination.Offset=len(interceptionIDs)
267263
}
268-
res,err:=experimentalClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{
264+
res,err:=client.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{
269265
Pagination:pagination,
270266
})
271267
require.NoError(t,err)
@@ -305,11 +301,9 @@ func TestAIBridgeListInterceptions(t *testing.T) {
305301
},
306302
},
307303
})
308-
adminExperimentalClient:=codersdk.NewExperimentalClient(adminClient)
309304
ctx:=testutil.Context(t,testutil.WaitLong)
310305

311306
secondUserClient,secondUser:=coderdtest.CreateAnotherUser(t,adminClient,firstUser.OrganizationID)
312-
secondUserExperimentalClient:=codersdk.NewExperimentalClient(secondUserClient)
313307

314308
now:=dbtime.Now()
315309
i1:=dbgen.AIBridgeInterception(t,db, database.InsertAIBridgeInterceptionParams{
@@ -322,15 +316,15 @@ func TestAIBridgeListInterceptions(t *testing.T) {
322316
},&now)
323317

324318
// Admin can see all interceptions.
325-
res,err:=adminExperimentalClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
319+
res,err:=adminClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
326320
require.NoError(t,err)
327321
require.EqualValues(t,2,res.Count)
328322
require.Len(t,res.Results,2)
329323
require.Equal(t,i1.ID,res.Results[0].ID)
330324
require.Equal(t,i2.ID,res.Results[1].ID)
331325

332326
// Second user can only see their own interceptions.
333-
res,err=secondUserExperimentalClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
327+
res,err=secondUserClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
334328
require.NoError(t,err)
335329
require.EqualValues(t,1,res.Count)
336330
require.Len(t,res.Results,1)
@@ -350,7 +344,6 @@ func TestAIBridgeListInterceptions(t *testing.T) {
350344
},
351345
},
352346
})
353-
experimentalClient:=codersdk.NewExperimentalClient(client)
354347
ctx:=testutil.Context(t,testutil.WaitLong)
355348

356349
user1,err:=client.User(ctx,codersdk.Me)
@@ -500,7 +493,7 @@ func TestAIBridgeListInterceptions(t *testing.T) {
500493
t.Run(tc.name,func(t*testing.T) {
501494
t.Parallel()
502495
ctx:=testutil.Context(t,testutil.WaitLong)
503-
res,err:=experimentalClient.AIBridgeListInterceptions(ctx,tc.filter)
496+
res,err:=client.AIBridgeListInterceptions(ctx,tc.filter)
504497
require.NoError(t,err)
505498
require.EqualValues(t,len(tc.want),res.Count)
506499
// We just compare UUID strings for the sake of this test.
@@ -530,7 +523,6 @@ func TestAIBridgeListInterceptions(t *testing.T) {
530523
},
531524
},
532525
})
533-
experimentalClient:=codersdk.NewExperimentalClient(client)
534526

535527
// No need to insert any test data, we're just testing the filter
536528
// errors.
@@ -587,7 +579,7 @@ func TestAIBridgeListInterceptions(t *testing.T) {
587579
t.Run(tc.name,func(t*testing.T) {
588580
t.Parallel()
589581
ctx:=testutil.Context(t,testutil.WaitLong)
590-
res,err:=experimentalClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{
582+
res,err:=client.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{
591583
FilterQuery:tc.q,
592584
})
593585
varsdkErr*codersdk.Error

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp