assistant: Require user to accept TOS for cloud provider (#16111)

This adds the requirement for users to accept the terms of service the
first time they send a message with the Cloud provider.

Once this is out and in a nightly, we need to add the check to the
server side too, to authenticate access to the models.

Demo:


https://github.com/user-attachments/assets/0edebf74-8120-4fa2-b801-bb76f04e8a17



Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-08-12 17:43:35 +02:00 committed by GitHub
parent 98f314ba21
commit fbb533b3e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 297 additions and 9 deletions

View file

@ -49,7 +49,7 @@ message Envelope {
GetDefinition get_definition = 32;
GetDefinitionResponse get_definition_response = 33;
GetDeclaration get_declaration = 237;
GetDeclarationResponse get_declaration_response = 238; // current max
GetDeclarationResponse get_declaration_response = 238;
GetTypeDefinition get_type_definition = 34;
GetTypeDefinitionResponse get_type_definition_response = 35;
@ -130,6 +130,8 @@ message Envelope {
GetPrivateUserInfoResponse get_private_user_info_response = 103;
UpdateUserPlan update_user_plan = 234;
UpdateDiffBase update_diff_base = 104;
AcceptTermsOfService accept_terms_of_service = 239;
AcceptTermsOfServiceResponse accept_terms_of_service_response = 240; // current max
OnTypeFormatting on_type_formatting = 105;
OnTypeFormattingResponse on_type_formatting_response = 106;
@ -270,7 +272,7 @@ message Envelope {
AddWorktreeResponse add_worktree_response = 223;
GetLlmToken get_llm_token = 235;
GetLlmTokenResponse get_llm_token_response = 236; // current max
GetLlmTokenResponse get_llm_token_response = 236;
}
reserved 158 to 161;
@ -1692,6 +1694,7 @@ message GetPrivateUserInfoResponse {
string metrics_id = 1;
bool staff = 2;
repeated string flags = 3;
optional uint64 accepted_tos_at = 4;
}
enum Plan {
@ -1703,6 +1706,12 @@ message UpdateUserPlan {
Plan plan = 1;
}
message AcceptTermsOfService {}
message AcceptTermsOfServiceResponse {
uint64 accepted_tos_at = 1;
}
// Entities
message ViewId {

View file

@ -187,6 +187,8 @@ impl fmt::Display for PeerId {
}
messages!(
(AcceptTermsOfService, Foreground),
(AcceptTermsOfServiceResponse, Foreground),
(Ack, Foreground),
(AckBufferOperation, Background),
(AckChannelMessage, Background),
@ -409,6 +411,7 @@ messages!(
);
request_messages!(
(AcceptTermsOfService, AcceptTermsOfServiceResponse),
(ApplyCodeAction, ApplyCodeActionResponse),
(
ApplyCompletionAdditionalEdits,