feat(server): add real-world prompt test for copilot apis (#8629)

fix AF-1432, PD-1176
This commit is contained in:
darkskygit
2024-11-01 07:05:12 +00:00
parent 1c22fdd371
commit 7a201984e9
32 changed files with 1928 additions and 58 deletions

View File

@@ -153,6 +153,9 @@ export class ChatActionList extends LitElement {
});
}
}}
data-testid="action-${action.title
.toLowerCase()
.replaceAll(' ', '-')}"
>
${action.title}
</div>

View File

@@ -178,13 +178,17 @@ export class ChatCopyMore extends WithDisposable(LitElement) {
this._notifySuccess('Copied to clipboard');
}
}}
data-testid="action-copy-button"
>
${CopyIcon}
<affine-tooltip>Copy</affine-tooltip>
</div>`
: nothing}
${isLast
? html`<div @click=${() => this.retry()}>
? html`<div
@click=${() => this.retry()}
data-testid="action-retry-button"
>
${RetryIcon}
<affine-tooltip>Retry</affine-tooltip>
</div>`

View File

@@ -371,6 +371,7 @@ export class ChatPanelInput extends WithDisposable(LitElement) {
}
}
}}
data-testid="chat-panel-input"
></textarea>
<div class="chat-panel-input-actions">
<div
@@ -378,6 +379,7 @@ export class ChatPanelInput extends WithDisposable(LitElement) {
@click=${async () => {
await this.cleanupHistories();
}}
data-testid="chat-panel-clear"
>
${ChatClearIcon}
</div>
@@ -410,6 +412,7 @@ export class ChatPanelInput extends WithDisposable(LitElement) {
@click="${this.send}"
class="chat-panel-send"
aria-disabled=${this.isInputEmpty}
data-testid="chat-panel-send"
>
${ChatSendIcon}
</div>`}

View File

@@ -379,7 +379,7 @@ export class ChatPanelMessages extends WithDisposable(ShadowlessElement) {
: html`<div class="avatar"></div>`}
</div>`
: AffineAvatarIcon}
${isUser ? 'You' : 'AFFINE AI'}
${isUser ? 'You' : 'AFFiNE AI'}
</div>`;
}

View File

@@ -244,7 +244,7 @@ export class ChatPanel extends WithDisposable(ShadowlessElement) {
override render() {
return html` <div class="chat-panel-container">
<div class="chat-panel-title">
<div>AFFINE AI</div>
<div>AFFiNE AI</div>
<div
@click=${() => {
AIProvider.toggleGeneralAIOnboarding?.(true);

View File

@@ -34,6 +34,7 @@ const ToggleButton = ({
onClick={onToggle}
className={className}
data-show={show}
data-testid="right-sidebar-toggle"
>
<RightSidebarIcon />
</IconButton>

View File

@@ -40,6 +40,7 @@ export const SidebarContainer = ({
styles.sidebarBodyTarget,
!BUILD_CONFIG.isElectron && styles.borderTop
)}
data-testid={`sidebar-tab-content-${sidebar.id}`}
/>
))
) : (

View File

@@ -22,6 +22,7 @@ export const SidebarHeaderSwitcher = () => {
tabId={tab.id}
/>
),
testId: `sidebar-tab-${tab.id}`,
style: { padding: 0, fontSize: 20, width: 24 },
}));