mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Route cyber Trusted Access links by plan type (#40504)
## What changed - Send `Free`, `Go`, `Plus`, `Pro`, and `ProLite` ChatGPT users to the individual Trusted Access page when a cybersecurity policy error ends a turn. - Keep the enterprise Trusted Access application for other plans and sessions without a ChatGPT account or known plan. ## Testing - Cover individual and enterprise link selection in chat widget tests and history-cell snapshots. GitOrigin-RevId: a563560d15c401b47f1865a6f58ea4692d31d457
This commit is contained in:
1 parent
ebe18fc982
commit
80e871309a
5 files changed
+53
-5
No files matched your search
@@ -93,6 +93,9 @@ pub(crate) struct SafetyAccessBlockCell {
|
||||
|
||||
const SAFETY_ACCESS_BLOCK_TITLE: &str = "This content can't be shown";
|
||||
const SAFETY_ACCESS_BLOCK_LEARN_MORE_URL: &str = "https://help.openai.com/en/articles/20001326";
|
||||
const CYBER_INDIVIDUAL_TRUSTED_ACCESS_URL: &str = "https://chatgpt.com/cyber/";
|
||||
const CYBER_ENTERPRISE_TRUSTED_ACCESS_URL: &str =
|
||||
"https://openai.com/form/enterprise-trusted-access-for-cyber/";
|
||||
|
||||
pub(crate) fn new_safety_access_block_event() -> SafetyAccessBlockCell {
|
||||
SafetyAccessBlockCell {
|
||||
@@ -101,10 +104,16 @@ pub(crate) fn new_safety_access_block_event() -> SafetyAccessBlockCell {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new_cyber_policy_error_event() -> SafetyAccessBlockCell {
|
||||
pub(crate) fn new_cyber_policy_error_event(plan_type: Option<PlanType>) -> SafetyAccessBlockCell {
|
||||
let trusted_access_url = match plan_type {
|
||||
Some(
|
||||
PlanType::Free | PlanType::Go | PlanType::Plus | PlanType::Pro | PlanType::ProLite,
|
||||
) => CYBER_INDIVIDUAL_TRUSTED_ACCESS_URL,
|
||||
_ => CYBER_ENTERPRISE_TRUSTED_ACCESS_URL,
|
||||
};
|
||||
SafetyAccessBlockCell {
|
||||
body: "We take extra caution with cybersecurity requests. If you’re a security professional, you may be able to apply for Trusted Access.",
|
||||
trusted_access_url: "https://openai.com/form/enterprise-trusted-access-for-cyber/",
|
||||
trusted_access_url,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
---
|
||||
source: tui/src/history_cell/tests.rs
|
||||
expression: rendered
|
||||
---
|
||||
ⓘ This content can't be shown
|
||||
We take extra caution with cybersecurity requests. If you’re a security
|
||||
professional, you may be able to apply for Trusted Access.
|
||||
Trusted Access: https://chatgpt.com/cyber/
|
||||
Learn more: https://help.openai.com/en/articles/20001326
|
||||
@@ -752,7 +752,14 @@ fn ps_output_multiline_snapshot() {
|
||||
|
||||
#[test]
|
||||
fn cyber_policy_error_event_snapshot() {
|
||||
let cell = new_cyber_policy_error_event();
|
||||
let cell = new_cyber_policy_error_event(/*plan_type*/ None);
|
||||
let rendered = render_lines(&cell.display_lines(/*width*/ 80)).join("\n");
|
||||
insta::assert_snapshot!(rendered);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cyber_policy_error_event_individual_snapshot() {
|
||||
let cell = new_cyber_policy_error_event(Some(PlanType::Pro));
|
||||
let rendered = render_lines(&cell.display_lines(/*width*/ 80)).join("\n");
|
||||
insta::assert_snapshot!(rendered);
|
||||
}
|
||||
@@ -766,7 +773,7 @@ fn safety_access_block_event_snapshot() {
|
||||
|
||||
#[test]
|
||||
fn cyber_policy_error_event_narrow_snapshot() {
|
||||
let cell = new_cyber_policy_error_event();
|
||||
let cell = new_cyber_policy_error_event(/*plan_type*/ None);
|
||||
let rendered = render_lines(&cell.display_lines(/*width*/ 36)).join("\n");
|
||||
insta::assert_snapshot!(rendered);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user