Compare commits

..

6 Commits

Author SHA1 Message Date
Yue Wu
c5da8ddb1e fix(core): ai send button not work (#9688)
Hotfix this AI send button not work issue.
2025-01-14 17:14:34 +08:00
eyhn
c7d621fd05 chore(i18n): update i18n metadata 2025-01-14 15:23:00 +08:00
github-actions[bot]
6a09ee461f chore(i18n): sync translations (#9513)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2025-01-14 15:21:59 +08:00
doodlewind
07f1e88592 fix(editor): blur in edgeless content zooming (#9496)
Fix [BS-2294](https://linear.app/affine-design/issue/BS-2294/edgeless-%E7%BC%A9%E6%94%BE%E5%AD%97%E5%8F%B7%E6%A8%A1%E7%B3%8A)
2025-01-14 15:21:50 +08:00
github-actions[bot]
bac8fca41e chore(i18n): sync translations (#9499)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2025-01-14 15:21:36 +08:00
forehalo
c583f3e135 fix(server): fail to load custom config (#9485)
closed #9237 #9417
2025-01-14 15:20:46 +08:00
2 changed files with 19 additions and 9 deletions

View File

@@ -364,8 +364,7 @@ export class ChatPanelInput extends WithDisposable(LitElement) {
}}
@keydown=${async (evt: KeyboardEvent) => {
if (evt.key === 'Enter' && !evt.shiftKey && !evt.isComposing) {
evt.preventDefault();
await this.send();
this._onTextareaSend(evt);
}
}}
@focus=${() => {
@@ -425,7 +424,7 @@ export class ChatPanelInput extends WithDisposable(LitElement) {
${ChatAbortIcon}
</div>`
: html`<div
@click="${this.send}"
@click="${this._onTextareaSend}"
class="chat-panel-send"
aria-disabled=${this.isInputEmpty}
data-testid="chat-panel-send"
@@ -436,19 +435,30 @@ export class ChatPanelInput extends WithDisposable(LitElement) {
</div>`;
}
send = async (input?: string) => {
private readonly _onTextareaSend = (e: MouseEvent | KeyboardEvent) => {
e.preventDefault();
e.stopPropagation();
const value = this.textarea.value.trim();
if (value.length === 0) return;
this.textarea.value = '';
this.isInputEmpty = true;
this.textarea.style.height = 'unset';
this.send(value).catch(console.error);
};
send = async (text: string) => {
const { status, markdown } = this.chatContextValue;
if (status === 'loading' || status === 'transmitting') return;
const text = input || this.textarea.value;
const { images } = this.chatContextValue;
if (!text && images.length === 0) {
return;
}
const { doc } = this.host;
this.textarea.value = '';
this.isInputEmpty = true;
this.textarea.style.height = 'unset';
this.updateContext({
images: [],
status: 'loading',

View File

@@ -25,7 +25,7 @@ export interface AIChatParams {
export interface AISendParams {
host: EditorHost;
input?: string;
input: string;
context?: Partial<ChatContextValue | null>;
}