Skip to content

Commit fa114b4

Browse files
committed
Pick up latest changes to sagemaker_ui_post_startup.sh
1 parent 93e2dad commit fa114b4

File tree

3 files changed

+71
-43
lines changed

3 files changed

+71
-43
lines changed

build_artifacts/v2/v2.6/v2.6.0-alpha-cpu/sagemaker_ui_post_startup.sh

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
#!/bin/bash
22
set -eux
33

4-
# Override Jupyter AI config file with specific content only for 2.6
5-
# this is a potential workaround for Q chat issue where the chat does not
6-
# load since it does not pick up the latest config file
7-
NB_USER=sagemaker-user
8-
# Check if Jupyter AI config file exists, override with specific content if so only for 2.6
9-
# this is a potential workaround for Q chat issue
10-
JUPYTER_AI_CONFIG_PATH=/home/${NB_USER}/.local/share/jupyter/jupyter_ai/config.json
11-
JUPYTER_AI_CONFIG_CONTENT='{
12-
"model_provider_id": "amazon-q:Q-Developer",
13-
"embeddings_provider_id": null,
14-
"send_with_shift_enter": false,
15-
"fields": {},
16-
"api_keys": {},
17-
"completions_model_provider_id": null,
18-
"completions_fields": {},
19-
"embeddings_fields": {}
20-
}'
21-
22-
# Overwrite the file if it exists (or create it if it doesn't)
23-
echo "$JUPYTER_AI_CONFIG_CONTENT" > "$JUPYTER_AI_CONFIG_PATH"
24-
4+
# Only run the following commands if SAGEMAKER_APP_TYPE_LOWERCASE is jupyterlab
5+
if [ "${SAGEMAKER_APP_TYPE_LOWERCASE}" = "jupyterlab" ]; then
6+
# Override Jupyter AI config file with specific content only for 2.6
7+
# this is a potential workaround for Q chat issue where the chat does not
8+
# load since it does not pick up the latest config file
9+
NB_USER=sagemaker-user
10+
# Check if Jupyter AI config file exists, override with specific content if so only for 2.6
11+
# this is a potential workaround for Q chat issue
12+
JUPYTER_AI_CONFIG_PATH=/home/${NB_USER}/.local/share/jupyter/jupyter_ai/config.json
13+
JUPYTER_AI_CONFIG_CONTENT='{
14+
"model_provider_id": "amazon-q:Q-Developer",
15+
"embeddings_provider_id": null,
16+
"send_with_shift_enter": false,
17+
"fields": {},
18+
"api_keys": {},
19+
"completions_model_provider_id": null,
20+
"completions_fields": {},
21+
"embeddings_fields": {}
22+
}'
23+
24+
# Overwrite the file if it exists (or create it if it doesn't)
25+
echo "$JUPYTER_AI_CONFIG_CONTENT" > "$JUPYTER_AI_CONFIG_PATH"
26+
fi
2527

2628
# Writes script status to file. This file is read by an IDE extension responsible for dispatching UI post-startup-status to the user.
2729
write_status_to_file() {

build_artifacts/v2/v2.6/v2.6.0-alpha-gpu/sagemaker_ui_post_startup.sh

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
#!/bin/bash
22
set -eux
33

4-
# Override Jupyter AI config file with specific content only for 2.6
5-
# this is a potential workaround for Q chat issue where the chat does not
6-
# load since it does not pick up the latest config file
7-
NB_USER=sagemaker-user
8-
# Check if Jupyter AI config file exists, override with specific content if so only for 2.6
9-
# this is a potential workaround for Q chat issue
10-
JUPYTER_AI_CONFIG_PATH=/home/${NB_USER}/.local/share/jupyter/jupyter_ai/config.json
11-
JUPYTER_AI_CONFIG_CONTENT='{
12-
"model_provider_id": "amazon-q:Q-Developer",
13-
"embeddings_provider_id": null,
14-
"send_with_shift_enter": false,
15-
"fields": {},
16-
"api_keys": {},
17-
"completions_model_provider_id": null,
18-
"completions_fields": {},
19-
"embeddings_fields": {}
20-
}'
21-
22-
# Overwrite the file if it exists (or create it if it doesn't)
23-
echo "$JUPYTER_AI_CONFIG_CONTENT" > "$JUPYTER_AI_CONFIG_PATH"
24-
4+
# Only run the following commands if SAGEMAKER_APP_TYPE_LOWERCASE is jupyterlab
5+
if [ "${SAGEMAKER_APP_TYPE_LOWERCASE}" = "jupyterlab" ]; then
6+
# Override Jupyter AI config file with specific content only for 2.6
7+
# this is a potential workaround for Q chat issue where the chat does not
8+
# load since it does not pick up the latest config file
9+
NB_USER=sagemaker-user
10+
# Check if Jupyter AI config file exists, override with specific content if so only for 2.6
11+
# this is a potential workaround for Q chat issue
12+
JUPYTER_AI_CONFIG_PATH=/home/${NB_USER}/.local/share/jupyter/jupyter_ai/config.json
13+
JUPYTER_AI_CONFIG_CONTENT='{
14+
"model_provider_id": "amazon-q:Q-Developer",
15+
"embeddings_provider_id": null,
16+
"send_with_shift_enter": false,
17+
"fields": {},
18+
"api_keys": {},
19+
"completions_model_provider_id": null,
20+
"completions_fields": {},
21+
"embeddings_fields": {}
22+
}'
23+
24+
# Overwrite the file if it exists (or create it if it doesn't)
25+
echo "$JUPYTER_AI_CONFIG_CONTENT" > "$JUPYTER_AI_CONFIG_PATH"
26+
fi
2527

2628
# Writes script status to file. This file is read by an IDE extension responsible for dispatching UI post-startup-status to the user.
2729
write_status_to_file() {

template/v2/dirs/etc/sagemaker-ui/sagemaker_ui_post_startup.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
#!/bin/bash
22
set -eux
33

4+
# Only run the following commands if SAGEMAKER_APP_TYPE_LOWERCASE is jupyterlab
5+
if [ "${SAGEMAKER_APP_TYPE_LOWERCASE}" = "jupyterlab" ]; then
6+
# Override Jupyter AI config file with specific content only for 2.6
7+
# this is a potential workaround for Q chat issue where the chat does not
8+
# load since it does not pick up the latest config file
9+
NB_USER=sagemaker-user
10+
# Check if Jupyter AI config file exists, override with specific content if so only for 2.6
11+
# this is a potential workaround for Q chat issue
12+
JUPYTER_AI_CONFIG_PATH=/home/${NB_USER}/.local/share/jupyter/jupyter_ai/config.json
13+
JUPYTER_AI_CONFIG_CONTENT='{
14+
"model_provider_id": "amazon-q:Q-Developer",
15+
"embeddings_provider_id": null,
16+
"send_with_shift_enter": false,
17+
"fields": {},
18+
"api_keys": {},
19+
"completions_model_provider_id": null,
20+
"completions_fields": {},
21+
"embeddings_fields": {}
22+
}'
23+
24+
# Overwrite the file if it exists (or create it if it doesn't)
25+
echo "$JUPYTER_AI_CONFIG_CONTENT" > "$JUPYTER_AI_CONFIG_PATH"
26+
fi
27+
428
# Writes script status to file. This file is read by an IDE extension responsible for dispatching UI post-startup-status to the user.
529
write_status_to_file() {
630
local status="$1"
@@ -172,4 +196,4 @@ if [ "${SAGEMAKER_APP_TYPE_LOWERCASE}" = "jupyterlab" ]; then
172196
bash /etc/sagemaker-ui/workflows/sm-spark-cli-install.sh
173197
fi
174198

175-
write_status_to_file_on_script_complete
199+
write_status_to_file_on_script_complete

0 commit comments

Comments
 (0)