Skip to content

Commit

Permalink
Merge branch 'main' into feat-html-content-transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
OEvgeny authored Oct 29, 2024
2 parents 2d2aeb4 + e5145f3 commit 5441819
Show file tree
Hide file tree
Showing 39 changed files with 463 additions and 78 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
- Improved drop zone behavior and styling in Fluent theme, in PR [#5328](https://github.com/microsoft/BotFramework-WebChat/pull/5328), by [@OEvgeny](https://github.com/OEvgeny)
- Excluded side effects from module entry points to prevent global scope modifications, in PR [#5329](https://github.com/microsoft/BotFramework-WebChat/pull/5329), by [@OEvgeny](https://github.com/OEvgeny)
- Moved to `micromark` for rendering Markdown, instead of `markdown-it`, in PR [#5330](https://github.com/microsoft/BotFramework-WebChat/pull/5330), by [@compulim](https://github.com/compulim)
- Improved view code dialog UI in Fluent theme with better styling and accessibility, in PR [#5337](https://github.com/microsoft/BotFramework-WebChat/pull/5337), by [@OEvgeny](https://github.com/OEvgeny)

### Fixed

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
174 changes: 144 additions & 30 deletions __tests__/html/fluentTheme/side-by-side.wide.dark.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,17 @@
let timestampStart = new Date(2020, 7, 9).getTime();
const timestamp = () => new Date(timestampStart += 100).toISOString();

const [leftTranscriptIndex = 0, rightTranscriptIndex = 1] = new URLSearchParams(location.search).getAll('transcript');
const [leftVariant = 'fluent', rightVariant = 'copilot'] = new URLSearchParams(location.search).getAll('variant');
const searchParams = new URLSearchParams(location.search);

const sendBoxIndexes = new URLSearchParams(location.search).getAll('focus');
const [leftTranscriptIndex = 0, rightTranscriptIndex = 1] = searchParams.getAll('transcript');
const [leftVariant = 'fluent', rightVariant = 'copilot'] = searchParams.getAll('variant');

const sendBoxIndexes = searchParams.getAll('focus');
const activeFocusPresets = searchParams.getAll('focus-preset');

const adjustStyleOptions = Object.fromEntries(['codeBlockTheme']
.map(key => [key, searchParams.get(key)])
.filter(([key, value]) => value));

const botIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJIAAACQCAMAAADUbcK3AAAC+lBMVEUAAADxX0TJpYvTsaLPsJn+a0zUuqTQspv4ZEj+XTvMdmP/akr6Wjr/c1TzUzbTtqH/ZUPRtJ3StZ7VuqXPrZTj1Mf/YT//ZkXh0cT8YUP+bUzgzcDRt6P0Vzv+YT/6akz/ZkX/bEzj1Mj/aUnUuKP/YkDh08f+aEjStp//XTv/YD3Rs5z/Xz3QsZrKqY/StaHi1MfaNx//YkL/Y0LMq5LNrJPKp43/b1Di08jTt6D/YkD+aUn8cFLLqY/+Wjzi08bLpoz/cVH/ZkX+bk/3Qyrg0cPUt6LcxrTWvar/eVrqRy//ZEL3QSb/XTrLqpDcxrXUuaP/a0r6Wjv0PiPj1cj1QSbxRCnhz8L+f2LMq5L/e134RSn5NR36e17dybrZwK77TTD6TjPg0cP/fV/QsZnrPif8RCv5KhT8PSTaxLP8RirXvqv5OyHEJRL/bEzJpYr/eVrEJxL9LBb+SS3/f1/8UDDPoYznRSr8JA/fzLzMLBbh08fbx7fXwK7VvKjcybrey7zYw7PWvqvUuqX/aEfezb/fz8H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9JiQ4Sw6c5MlkMhkVWnlJKwJMm3mTsPfRCZ9nCI6rCKOitamZm+C6fd5ZNXHZ2SpAfofybRZmXG7Nxn9V85otOo1qowEhVog/y+oEjIzcuJUKC4uJyM1kXr+e3jx1CqQVqeOIZEiRYoUKVKkSJEiRYoUtL4DkaWZtZT0Fr4AAAAASUVORK5CYII=';

Expand All @@ -94,6 +101,27 @@
}
};

const waveSvg = `data:image/svg+xml;utf8,${encodeURIComponent(`
<svg width="400" height="200" viewBox="0 0 400 200" xmlns="http://www.w3.org/2000/svg">
<!-- Primary Wave -->
<path d="M0,100 C50,50 100,150 150,100 C200,50 250,150 300,100 C350,50 400,150 400,100"
stroke="#3B82F6" fill="none" stroke-width="2" opacity="0.5"/>
<!-- Second Harmonic -->
<path d="M0,100 C25,75 50,125 75,100 C100,75 125,125 150,100 C175,75 200,125 225,100 C250,75 275,125 300,100 C325,75 350,125 375,100 C400,75 400,125 400,100"
stroke="#10B981" fill="none" stroke-width="2" opacity="0.5"/>
<!-- Combined Wave -->
<path d="M0,100 C40,30 80,170 120,100 C160,30 200,170 240,100 C280,30 320,170 360,100 C380,65 400,135 400,100"
stroke="#EF4444" fill="none" stroke-width="3"/>
<!-- Grid Lines -->
<line x1="0" y1="100" x2="400" y2="100" stroke="#CBD5E1" stroke-width="0.5" stroke-dasharray="4"/>
<line x1="100" y1="0" x2="100" y2="200" stroke="#CBD5E1" stroke-width="0.5" stroke-dasharray="4"/>
<line x1="200" y1="0" x2="200" y2="200" stroke="#CBD5E1" stroke-width="0.5" stroke-dasharray="4"/>
<line x1="300" y1="0" x2="300" y2="200" stroke="#CBD5E1" stroke-width="0.5" stroke-dasharray="4"/>
</svg>`)}`;

const transcripts = [[
{
timestamp: timestamp(),
Expand Down Expand Up @@ -511,6 +539,63 @@
streamSequence: 99
}
}
], [
{
timestamp: timestamp(),
from: { role: 'bot' },
entities: [{
...aiMessageEntity,
isBasedOn: {
'@type': 'SoftwareSourceCode',
'programmingLanguage': 'python',
"text": `import numpy as np
import matplotlib.pyplot as plt
def plot_sine_waves():
"""Create a beautiful visualization of sine waves with different frequencies."""
# Generate time points
t = np.linspace(0, 10, 1000)
# Create waves with different frequencies and phases
wave1 = np.sin(t)
wave2 = 0.5 * np.sin(2 * t + np.pi/4)
wave3 = 0.3 * np.sin(3 * t + np.pi/3)
# Combine waves
combined = wave1 + wave2 + wave3
# Create a stylish plot
plt.style.use('seaborn-darkgrid')
plt.figure(figsize=(12, 8))
# Plot individual waves
plt.plot(t, wave1, label='Primary Wave', alpha=0.5)
plt.plot(t, wave2, label='Second Harmonic', alpha=0.5)
plt.plot(t, wave3, label='Third Harmonic', alpha=0.5)
# Plot combined wave with a thicker line
plt.plot(t, combined, 'r-',
label='Combined Wave',
linewidth=2)
plt.title('Harmonic Wave Composition', fontsize=14)
plt.xlabel('Time', fontsize=12)
plt.ylabel('Amplitude', fontsize=12)
plt.legend()
plt.grid(True, alpha=0.3)
# Show the plot
plt.tight_layout()
plt.show()
# Generate the visualization
plot_sine_waves()`
}
}],
id: "a4c0c01d-c06e-4dde-9278-265c607b545b-82",
type: "message",
text: `This example demonstrates creating a beautiful visualization of harmonic waves using Python's Matplotlib library. The code generates three sine waves with different frequencies and phases, then combines them to show wave interference patterns.\n<img alt="wave plot" src="${waveSvg}">`,
}
]];

const leftStore = testHelpers.createStore();
Expand Down Expand Up @@ -557,7 +642,8 @@
TEXT_INPUT_PLACEHOLDER: 'Describe how your copilot should behave'
}}
styleOptions={{
maxMessageLength: null
maxMessageLength: null,
...adjustStyleOptions
}}
/>
</FluentThemeProvider>
Expand All @@ -568,12 +654,14 @@
directLine={rightDirectLine}
store={rightStore}
overrideLocalizedStrings={{
TEXT_INPUT_PLACEHOLDER: 'Ask a work question or use / to reference people, files and more'
TEXT_INPUT_PLACEHOLDER: 'Ask a work question or use / to reference people, files and more',
ACTIVITY_CODE_CAUTION: 'AI-generated code. Review and use carefully. [More info on FAQ](https://aka.ms/AIandCopilotFAQs).'
}}
styleOptions={{
groupTimestamp: 1,
timestampFormat: 'absolute',
botAvatarBackgroundColor: '#304E7A'
botAvatarBackgroundColor: '#304E7A',
...adjustStyleOptions
}}
/>
</FluentThemeProvider>
Expand All @@ -586,30 +674,56 @@

await host.snapshot();

const sendboxes = Array.from(document.querySelectorAll(`[data-testid="${WebChat.testIds.sendBoxTextBox}"]`)).filter((_, index) => sendBoxIndexes.includes(String(index)));

for (const sendbox of sendboxes) {
sendbox.focus();
await host.sendKeys('Next message');
await host.snapshot();
await host.sendKeys('ENTER');
// hide timestamp to not fail snapshot if is not relative
sendbox.parentElement.parentElement.parentElement.parentElement.querySelector('.webchat__basic-transcript__activity:last-child .webchat__stacked-layout__status').style.opacity = 0
await host.snapshot();
await host.sendShiftTab();
await host.snapshot();
await host.sendKeys('HOME');
await host.snapshot();
await host.sendKeys('END');
await host.snapshot();
await host.sendKeys('ARROW_UP');
await host.snapshot();
await host.sendKeys('ENTER');
await host.sendShiftTab();
await host.snapshot();
await host.sendKeys('ENTER');
await host.snapshot();
await host.sendKeys('ESCAPE');
const focusPresetsMap = new Map(Object.entries({
navigation: async sendbox => {
sendbox.focus();
await host.sendKeys('Next message');
await host.snapshot();
await host.sendKeys('ENTER');
// hide timestamp to not fail snapshot if is not relative
sendbox.parentElement.parentElement.parentElement.parentElement.querySelector('.webchat__basic-transcript__activity:last-child .webchat__stacked-layout__status').style.opacity = 0
await host.snapshot();
await host.sendShiftTab();
await host.snapshot();
await host.sendKeys('HOME');
await host.snapshot();
await host.sendKeys('END');
await host.snapshot();
await host.sendKeys('ARROW_UP');
await host.snapshot();
await host.sendKeys('ENTER');
await host.sendShiftTab();
await host.snapshot();
await host.sendKeys('ENTER');
await host.snapshot();
await host.sendKeys('ESCAPE');
},
viewCode: async sendbox => {
sendbox.focus();
await host.sendShiftTab();
await host.sendKeys('ARROW_UP');
await host.sendKeys('ENTER');
await host.snapshot();
await host.sendKeys('ENTER');
await host.snapshot();
await host.sendKeys('ENTER');
await host.snapshot();
}
}));

const sendboxes = Array.from(document.querySelectorAll(`[data-testid="${WebChat.testIds.sendBoxTextBox}"]`))
.filter((_, index) => sendBoxIndexes.includes(String(index)));

const focusPresets = activeFocusPresets
.map(presetName => focusPresetsMap.get(presetName))
.filter(preset => preset)

if (!focusPresets.length) focusPresets.push(focusPresetsMap.get('navigation'));

for (const preset of focusPresets) {
for (const sendbox of sendboxes) {
await preset(sendbox)
}
}
});
// TODO: unskip and try ShadowDOM when we get support
Expand Down
4 changes: 4 additions & 0 deletions __tests__/html/fluentTheme/side-by-side.wide.dark.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ describe('Fluent theme applied', () => {
runHTML('fluentTheme/side-by-side.wide.dark?transcript=0&transcript=4'));
test('side by side left - fluent, right - fluent', () =>
runHTML('fluentTheme/side-by-side.wide.dark?transcript=0&transcript=2&focus=1&variant=fluent&variant=fluent'));
test('side by side left - transcript, right - codeblock', () =>
runHTML('fluentTheme/side-by-side.wide.dark?transcript=0&transcript=5&focus=1&focus-preset=viewCode'));
test('side by side left - transcript, right - codeblock dark', () =>
runHTML('fluentTheme/side-by-side.wide.dark?transcript=0&transcript=5&focus=1&focus-preset=viewCode&codeBlockTheme=github-dark-default'));
});
});
Loading

0 comments on commit 5441819

Please sign in to comment.