Skip to content

Commit 0eb8dc3

Browse files
committed
Merge branch 'main' into chat-data-suggestion-styling
2 parents e33f8df + c5d9b9b commit 0eb8dc3

37 files changed

+184
-54
lines changed

js/chat/chat.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ shiny-chat-message {
9393
// images and avatars are full-bleed
9494
height: 100%;
9595
width: 100%;
96+
max-width: 100%;
97+
max-height: 100%;
9698
margin: 0 !important;
9799
object-fit: contain;
98100
}
@@ -105,6 +107,13 @@ shiny-chat-message {
105107
max-height: 66%;
106108
max-width: 66%;
107109
}
110+
111+
// Provide .border-0 as a way to opt-out of border container
112+
&:has(> .border-0) {
113+
border: none;
114+
border-radius: unset;
115+
overflow: unset;
116+
}
108117
}
109118

110119
/* Vertically center the 2nd column (message content) */
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
{
22
"type": "app",
33
"id": "chat-ai-anthropic-aws",
4-
"title": "Chat AI using Anthropic via AWS Bedrock"
4+
"title": "Chat AI using Anthropic via AWS Bedrock",
5+
"next_steps": [
6+
"Put your Bedrock credentials in the `template.env` file and rename it to `.env`.",
7+
"Run the app with `shiny run app.py`."
8+
],
9+
"follow_up": [
10+
{
11+
"type": "info",
12+
"text": "Need help connecting to Bedrock?"
13+
},
14+
{
15+
"type": "action",
16+
"text": "Learn more at https://posit-dev.github.io/chatlas/reference/ChatBedrockAnthropic.html"
17+
}
18+
]
519
}

shiny/templates/chat/llm-enterprise/aws-bedrock-anthropic/app.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
load_dotenv()
1616
chat_model = ChatBedrockAnthropic(
1717
model="anthropic.claude-3-sonnet-20240229-v1:0",
18-
# aws_secret_key=os.getenv("AWS_SECRET_KEY"),
19-
# aws_access_key=os.getenv("AWS_ACCESS_KEY"),
20-
# aws_region=os.getenv("AWS_REGION"),
21-
# aws_account_id=os.getenv("AWS_ACCOUNT_ID"),
2218
)
2319

2420
# Set some Shiny page options
@@ -36,5 +32,5 @@
3632
# Define a callback to run when the user submits a message
3733
@chat.on_user_submit
3834
async def handle_user_input(user_input: str):
39-
response = chat_model.stream(user_input)
35+
response = await chat_model.stream_async(user_input)
4036
await chat.append_message_stream(response)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
shiny
22
python-dotenv
3-
tokenizers
43
chatlas
54
anthropic[bedrock]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Once you provided your API key, rename this file to .env
2+
# The load_dotenv() in the app.py will then load this env variable
3+
AWS_SECRET_KEY=<Your AWS info here>
4+
AWS_ACCESS_KEY=<Your AWS info here>
5+
AWS_REGION=<Your AWS info here>
6+
AWS_ACCOUNT_ID=<Your AWS info here>
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
{
22
"type": "app",
33
"id": "chat-ai-azure-openai",
4-
"title": "Chat AI using OpenAI via Azure"
4+
"title": "Chat AI using OpenAI via Azure",
5+
"next_steps": [
6+
"Put your Azure credentials in the `template.env` file and rename it to `.env`.",
7+
"Run the app with `shiny run app.py`."
8+
],
9+
"follow_up": [
10+
{
11+
"type": "info",
12+
"text": "Need help connecting to Azure?"
13+
},
14+
{
15+
"type": "action",
16+
"text": "Learn more at https://posit-dev.github.io/chatlas/reference/ChatAzureOpenAI.html"
17+
}
18+
]
519
}

shiny/templates/chat/llm-enterprise/azure-openai/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@
3737
# Define a callback to run when the user submits a message
3838
@chat.on_user_submit
3939
async def handle_user_input(user_input: str):
40-
response = chat_model.stream(user_input)
40+
response = await chat_model.stream_async(user_input)
4141
await chat.append_message_stream(response)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
shiny
22
python-dotenv
3-
tokenizers
43
chatlas
54
openai
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Once you provided your API key, rename this file to .env
2+
# The load_dotenv() in the app.py will then load this env variable
3+
AZURE_OPENAI_API_KEY=<Your Azure OpenAI API key>
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
{
22
"type": "app",
33
"id": "chat-ai-anthropic",
4-
"title": "Chat AI using Anthropic"
4+
"title": "Chat AI using Anthropic",
5+
"next_steps": [
6+
"Put your Anthropic API key in the `template.env` file and rename it to `.env`.",
7+
"Run the app with `shiny run app.py`."
8+
],
9+
"follow_up": [
10+
{
11+
"type": "info",
12+
"text": "Need help obtaining an API key?"
13+
},
14+
{
15+
"type": "action",
16+
"text": "Learn how to obtain one at https://posit-dev.github.io/chatlas/reference/ChatAnthropic.html"
17+
}
18+
]
519
}

0 commit comments

Comments
 (0)