Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dark theme playground #190492

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const Header: React.FC<HeaderProps> = ({
<EuiPageTemplate.Header
css={{
'.euiPageHeaderContent > .euiFlexGroup': { flexWrap: 'wrap' },
backgroundColor: euiTheme.colors.ghost,
backgroundColor: euiTheme.colors.emptyShade,
}}
paddingSize="s"
data-test-subj="chat-playground-home-page"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ export const AssistantMessage: React.FC<AssistantMessageProps> = ({ message }) =
const username = i18n.translate('xpack.searchPlayground.chat.message.assistant.username', {
defaultMessage: 'AI',
});
const AIMessageWrapperCSS = css`
.euiAvatar {
background-color: ${euiTheme.colors.emptyShade};
},
.euiCommentEvent {
border: ${euiTheme.border.thin};
border-radius: ${euiTheme.border.radius.medium};
},
`;

return (
<>
Expand All @@ -59,13 +68,7 @@ export const AssistantMessage: React.FC<AssistantMessageProps> = ({ message }) =
timelineAvatar="dot"
data-test-subj="assistant-message-searching"
eventColor="subdued"
css={{
'.euiAvatar': { backgroundColor: euiTheme.colors.ghost },
'.euiCommentEvent': {
border: euiTheme.border.thin,
borderRadius: euiTheme.border.radius.medium,
},
}}
css={AIMessageWrapperCSS}
event={
<EuiText size="s">
<p>
Expand All @@ -83,13 +86,7 @@ export const AssistantMessage: React.FC<AssistantMessageProps> = ({ message }) =
timelineAvatar="dot"
data-test-subj="retrieval-docs-comment"
eventColor="subdued"
css={{
'.euiAvatar': { backgroundColor: euiTheme.colors.ghost },
'.euiCommentEvent': {
border: euiTheme.border.thin,
borderRadius: euiTheme.border.radius.medium,
},
}}
css={AIMessageWrapperCSS}
event={
<>
<EuiText size="s">
Expand Down Expand Up @@ -133,13 +130,7 @@ export const AssistantMessage: React.FC<AssistantMessageProps> = ({ message }) =
timelineAvatar="dot"
data-test-subj="retrieval-docs-comment-no-docs"
eventColor="subdued"
css={{
'.euiAvatar': { backgroundColor: euiTheme.colors.ghost },
'.euiCommentEvent': {
border: euiTheme.border.thin,
borderRadius: euiTheme.border.radius.medium,
},
}}
css={AIMessageWrapperCSS}
event={
<>
<EuiText size="s">
Expand Down Expand Up @@ -189,9 +180,9 @@ export const AssistantMessage: React.FC<AssistantMessageProps> = ({ message }) =
})
}
css={{
'.euiAvatar': { backgroundColor: euiTheme.colors.ghost },
'.euiAvatar': { backgroundColor: euiTheme.colors.emptyShade },
'.euiCommentEvent__body': {
backgroundColor: euiTheme.colors.ghost,
backgroundColor: euiTheme.colors.emptyShade,
},
}}
eventColor="subdued"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const SystemMessage: React.FC<SystemMessageProps> = ({ content }) => {
timelineAvatar="dot"
eventColor="subdued"
css={{
'.euiAvatar': { backgroundColor: euiTheme.colors.ghost },
'.euiAvatar': { backgroundColor: euiTheme.colors.emptyShade },
'.euiCommentEvent': {
border: euiTheme.border.thin,
borderRadius: euiTheme.border.radius.medium,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const UserMessage: React.FC<UserMessageProps> = ({ content, createdAt })
eventColor="subdued"
css={{
'.euiCommentEvent__body': {
backgroundColor: euiTheme.colors.ghost,
backgroundColor: euiTheme.colors.emptyShade,
},
}}
username={i18n.translate('xpack.searchPlayground.chat.message.user.name', {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ openai_client = OpenAI(

index_source_fields = ${JSON.stringify(formValues.source_fields, null, 4)}

def get_elasticsearch_results(query):
def get_elasticsearch_results():
es_query = ${getESQuery({
...formValues.elasticsearch_query,
size: formValues.doc_size,
Expand Down Expand Up @@ -71,7 +71,7 @@ def generate_openai_completion(user_prompt, question):

if __name__ == "__main__":
question = "my question"
elasticsearch_results = get_elasticsearch_results(question)
elasticsearch_results = get_elasticsearch_results()
context_prompt = create_openai_prompt(elasticsearch_results)
openai_completion = generate_openai_completion(context_prompt, question)
print(openai_completion)
Expand Down