Skip to content

Commit 2d00755

Browse files
authored
Copilot V2 new default, rm Copilot V1 (#14729)
* Copilot V2 new default, rm Copilot V1 * Tidy up styles
1 parent 23e8e2e commit 2d00755

File tree

8 files changed

+10
-67
lines changed

8 files changed

+10
-67
lines changed

assets/css/bundle.css

+2-6
Original file line numberDiff line numberDiff line change
@@ -3139,19 +3139,15 @@ div.highlight.line-numbers pre.chroma code span.line::before{
31393139
}
31403140
}
31413141

3142-
#ai-sidebar-host{
3143-
display:none
3144-
}
3145-
3146-
pulumi-copilot,#ai-sidebar-target{
3142+
pulumi-copilot{
31473143
position:fixed;
31483144
z-index:10;
31493145
top:108px;
31503146
right:0;
31513147
bottom:0
31523148
}
31533149

3154-
.section- #ai-sidebar-target,.section- pulumi-copilot{
3150+
.section- pulumi-copilot{
31553151
top:200px
31563152
}
31573153

assets/js/bundle.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/_default/config.yml

-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ security:
88
- ASSET_BUNDLE_ID
99
- PULUMI_CONVERT_URL
1010
- PULUMI_AI_WS_URL
11-
- PULUMI_COPILOT_URL
1211
- PULUMI_ATLAS_URL
13-
- DEV_PULUMI_COPILOT_BASE_PATH
1412
- GITHUB_TOKEN
1513
- ALGOLIA_APP_ID
1614
- ALGOLIA_APP_SEARCH_KEY

layouts/partials/copilot/sidebar.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
{{ $copilotApiUrl := getenv "PULUMI_COPILOT_URL" }}
21
{{ $atlasUrl := getenv "PULUMI_ATLAS_URL" }}
3-
{{ if or $copilotApiUrl $atlasUrl }}
4-
{{ $copilotBasePath := or (getenv "DEV_PULUMI_COPILOT_BASE_PATH") "/pulumi-ai/copilot" }}
5-
<copilot-sidebar copilot-src="{{ $copilotBasePath }}/sidebar?hostApp=docs&apiHost={{ $copilotApiUrl | urlquery }}" atlas-url="{{ $atlasUrl }}"></copilot-sidebar>
2+
{{ if $atlasUrl }}
3+
<copilot-sidebar atlas-url="{{ $atlasUrl }}"></copilot-sidebar>
64
{{ end }}

scripts/build-site.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ export PULUMI_AI_WS_URL=${PULUMI_AI_WS_URL:-$(pulumi stack output --stack pulumi
1010

1111
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1212
INFRA_PATH="$SCRIPT_DIR/../infrastructure"
13-
# Read Copilot API URL from Pulumi config, ignoring any errors.
13+
# Read Copilot ("atlas") API URL from Pulumi config, ignoring any errors.
1414
# If the config value is not set Copilot will not be available.
15-
export PULUMI_COPILOT_URL=${PULUMI_COPILOT_URL:-$(pulumi --cwd "$INFRA_PATH" config get copilotUrl 2>/dev/null || echo "")}
16-
printf "Copilot URL: $PULUMI_COPILOT_URL\n"
1715
export PULUMI_ATLAS_URL=${PULUMI_ATLAS_URL:-$(pulumi --cwd "$INFRA_PATH" config get atlasUrl 2>/dev/null || echo "")}
1816
printf "Atlas URL: $PULUMI_ATLAS_URL\n"
1917

theme/src/scss/_copilot.scss

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
// Host iframe
2-
// Should not be shown, when loaded it will portal the content to the sidebar target
3-
#ai-sidebar-host {
4-
display: none
5-
}
6-
7-
// Element that will be the target of the portal
8-
// If empty it will have a width of 0 and will not be visible.
9-
pulumi-copilot, #ai-sidebar-target {
1+
pulumi-copilot {
102
// Relative to the viewport so copilot moves w/ the scrolling
113
position: fixed;
124

@@ -26,7 +18,6 @@ pulumi-copilot, #ai-sidebar-target {
2618
// ---
2719

2820
/* FIXME: no section suffix? */
29-
.section- #ai-sidebar-target,
3021
.section- pulumi-copilot {
3122
top: 200px;
3223
}

theme/stencil/src/components.d.ts

-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { MultiSelectFormItem } from "./components/pulumi-multi-select-form/pulum
1414
export namespace Components {
1515
interface CopilotSidebar {
1616
"atlasUrl": string;
17-
"copilotSrc": string;
1817
}
1918
interface EventSessionRegistrationModal {
2019
"buttonClass": string;
@@ -518,7 +517,6 @@ declare global {
518517
declare namespace LocalJSX {
519518
interface CopilotSidebar {
520519
"atlasUrl"?: string;
521-
"copilotSrc"?: string;
522520
}
523521
interface EventSessionRegistrationModal {
524522
"buttonClass"?: string;

theme/stencil/src/components/copilot-sidebar/copilot-sidebar.tsx

+3-39
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
import { Component, h, Host, Prop, State } from "@stencil/core";
2-
import { gb } from "../../util/util";
3-
4-
const ATLAS_LOCAL_STORAGE_KEY = "pulumi-ai-use-atlas";
5-
62

73
@Component({
84
tag: "copilot-sidebar",
95
styleUrl: "copilot-sidebar.css",
106
shadow: false,
117
})
128
export class CopilotSidebar {
13-
149
//
1510
// Props
1611
//
1712

18-
// The copilotSrc is URL where the copilot sidebar is hosted
19-
@Prop()
20-
copilotSrc: string;
21-
2213
// The atlasUrl is the URL where the Atlas web component is hosted
2314
@Prop()
2415
atlasUrl: string;
@@ -27,26 +18,12 @@ export class CopilotSidebar {
2718
// Internal state
2819
//
2920

30-
// Whether to show the sidebar (growthbook flag)
31-
@State()
32-
showSidebar = false;
33-
34-
// Whether to show the Atlas web component (local storage flag)
35-
@State()
36-
showAtlas = false;
37-
3821
// Whether the Atlas scripts have been loaded
3922
@State()
4023
atlasScriptsLoaded = false;
4124

4225
async componentWillLoad() {
43-
this.showSidebar = gb.isOn("copilot-on-docs");
44-
gb.setRenderer(() => (this.showSidebar = gb.isOn("copilot-on-docs")));
45-
46-
this.showAtlas = this.atlasUrl && window.localStorage.getItem(ATLAS_LOCAL_STORAGE_KEY) !== "false";
47-
if (this.showAtlas) {
48-
await this.loadAtlasScripts();
49-
}
26+
await this.loadAtlasScripts();
5027
}
5128

5229
private async loadAtlasScripts() {
@@ -80,26 +57,13 @@ export class CopilotSidebar {
8057
}
8158

8259
render() {
83-
if (this.showAtlas) {
84-
if (!this.atlasScriptsLoaded) {
85-
return <Host></Host>;
86-
}
87-
88-
return (
89-
<Host>
90-
<pulumi-copilot hostApp="docs" apiUrl={this.atlasUrl} />
91-
</Host>
92-
);
93-
}
94-
95-
if (!this.showSidebar) {
60+
if (!this.atlasScriptsLoaded) {
9661
return <Host></Host>;
9762
}
9863

9964
return (
10065
<Host>
101-
<aside id="ai-sidebar-target"></aside>
102-
<iframe id="ai-sidebar-host" src={this.copilotSrc}></iframe>
66+
<pulumi-copilot hostApp="docs" apiUrl={this.atlasUrl} />
10367
</Host>
10468
);
10569
}

0 commit comments

Comments
 (0)