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

Commit4a57ce2

Browse files
committed
fix: review comments
1 parent9f75609 commit4a57ce2

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

‎coderd/database/dbauthz/dbauthz.go‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,14 @@ func (q *querier) authorizePrebuiltWorkspace(ctx context.Context, action policy.
178178
// authorizeAIBridgeInterceptionUpdate validates that the context's actor matches the initiator of the AIBridgeInterception.
179179
// This is used by all of the sub-resources which fall under the [ResourceAibridgeInterception] umbrella.
180180
func (q*querier)authorizeAIBridgeInterceptionUpdate(ctx context.Context,interceptionID uuid.UUID)error {
181-
182181
inter,err:=q.db.GetAIBridgeInterceptionByID(ctx,interceptionID)
183182
iferr!=nil {
184183
returnxerrors.Errorf("fetch aibridge interception %q: %w",interceptionID,err)
185184
}
186185

187-
err=q.authorizeContext(ctx,policy.ActionUpdate,inter.RBACObject())
188-
iferr!=nil {
189-
returnerr
186+
err=q.authorizeContext(ctx,policy.ActionUpdate,inter.RBACObject())
187+
iferr!=nil {
188+
returnerr
190189
}
191190

192191
returnnil

‎coderd/database/migrations/000370_aibridge.up.sql‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,63 @@ CREATE TABLE IF NOT EXISTS aibridge_interceptions (
66
started_atTIMESTAMP WITH TIME ZONENOT NULL
77
);
88

9+
COMMENT ON TABLE aibridge_interceptions IS'Audit log of requests intercepted by AI Bridge';
10+
COMMENT ON COLUMN aibridge_incerceptions.initiator_id IS'Relates to a users record, but FK is elided for performance.';
11+
912
CREATEINDEXidx_aibridge_interceptions_initiator_idON aibridge_interceptions (initiator_id);
1013

1114
CREATETABLEIF NOT EXISTS aibridge_token_usages (
1215
id UUIDPRIMARY KEY,
1316
interception_id UUIDNOT NULL,
14-
provider_response_idTEXTNOT NULL,-- The ID for the response in which the tokens were used, produced by the provider.
17+
provider_response_idTEXTNOT NULL,
1518
input_tokensBIGINTNOT NULL,
1619
output_tokensBIGINTNOT NULL,
1720
metadata JSONB DEFAULTNULL,
1821
created_atTIMESTAMP WITH TIME ZONENOT NULL
1922
);
2023

24+
COMMENT ON TABLE aibridge_token_usages IS'Audit log of tokens used by intercepted requests in AI Bridge';
25+
COMMENT ON COLUMN aibridge_token_usages.provider_response_id IS'The ID for the response in which the tokens were used, produced by the provider.';
26+
2127
CREATEINDEXidx_aibridge_token_usages_interception_idON aibridge_token_usages (interception_id);
2228

2329
CREATEINDEXidx_aibridge_token_usages_provider_response_idON aibridge_token_usages (provider_response_id);
2430

2531
CREATETABLEIF NOT EXISTS aibridge_user_prompts (
2632
id UUIDPRIMARY KEY,
2733
interception_id UUIDNOT NULL,
28-
provider_response_idTEXTNOT NULL,-- The ID for the response in which the tokens were used, produced by the provider.
34+
provider_response_idTEXTNOT NULL,
2935
promptTEXTNOT NULL,
3036
metadata JSONB DEFAULTNULL,
3137
created_atTIMESTAMP WITH TIME ZONENOT NULL
3238
);
3339

40+
COMMENT ON TABLE aibridge_user_prompts IS'Audit log of prompts used by intercepted requests in AI Bridge';
41+
COMMENT ON COLUMN aibridge_user_prompts.provider_response_id IS'The ID for the response to the given prompt, produced by the provider.';
42+
3443
CREATEINDEXidx_aibridge_user_prompts_interception_idON aibridge_user_prompts (interception_id);
3544

3645
CREATEINDEXidx_aibridge_user_prompts_provider_response_idON aibridge_user_prompts (provider_response_id);
3746

3847
CREATETABLEIF NOT EXISTS aibridge_tool_usages (
3948
id UUIDPRIMARY KEY,
4049
interception_id UUIDNOT NULL,
41-
provider_response_idTEXTNOT NULL,-- The ID for the response in which the tokens were used, produced by the provider.
42-
server_urlTEXTNULL,-- The name of the MCP server against which this tool was invoked. May be NULL, in which case the tool was defined by the client, not injected.
50+
provider_response_idTEXTNOT NULL,
51+
server_urlTEXTNULL,
4352
toolTEXTNOT NULL,
4453
inputTEXTNOT NULL,
45-
injectedBOOLEANNOT NULL DEFAULT FALSE,-- Whether this tool was injected; i.e. Bridge injected these tools into the request from an MCP server. If false it means a tool was defined by the client and already existed in the request (MCP or built-in).
46-
invocation_errorTEXTNULL,-- Only injected tools are invoked.
54+
injectedBOOLEANNOT NULL DEFAULT FALSE,
55+
invocation_errorTEXTNULL,
4756
metadata JSONB DEFAULTNULL,
4857
created_atTIMESTAMP WITH TIME ZONENOT NULL
4958
);
5059

60+
COMMENT ON TABLE aibridge_tool_usages IS'Audit log of tool calls in intercepted requests in AI Bridge';
61+
COMMENT ON COLUMN aibridge_tool_usages.provider_response_id IS'The ID for the response in which the tools were used, produced by the provider.';
62+
COMMENT ON COLUMN aibridge_tool_usages.server_url IS'The name of the MCP server against which this tool was invoked. May be NULL, in which case the tool was defined by the client, not injected.';
63+
COMMENT ON COLUMN aibridge_tool_usages.injected IS'Whether this tool was injected; i.e. Bridge injected these tools into the request from an MCP server. If false it means a tool was defined by the client and already existed in the request (MCP or built-in).';
64+
COMMENT ON COLUMN aibridge_tool_usages.invocation_error IS'Only injected tools are invoked.';
65+
5166
CREATEINDEXidx_aibridge_tool_usages_interception_idON aibridge_tool_usages (interception_id);
5267

5368
CREATEINDEXidx_aibridge_tool_usagesprovider_response_idON aibridge_tool_usages (provider_response_id);

‎coderd/database/queries/aibridge.sql‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ INSERT INTO aibridge_tool_usages (
2525
);
2626

2727
-- name: GetAIBridgeInterceptionByID :one
28-
SELECT*FROM aibridge_interceptionsWHERE id= @id::uuid
29-
LIMIT1;
28+
SELECT*FROM aibridge_interceptionsWHERE id= @id::uuid;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp