diff --git a/packages/blocks/src/_common/components/ai-item/ai-sub-item-list.ts b/packages/blocks/src/_common/components/ai-item/ai-sub-item-list.ts
index 8375fa135501..330acd42651a 100644
--- a/packages/blocks/src/_common/components/ai-item/ai-sub-item-list.ts
+++ b/packages/blocks/src/_common/components/ai-item/ai-sub-item-list.ts
@@ -15,7 +15,6 @@ export class AISubItemList extends WithDisposable(LitElement) {
display: flex;
flex-direction: column;
box-sizing: border-box;
- position: absolute;
padding: 8px;
min-width: 240px;
max-height: 320px;
diff --git a/packages/blocks/src/_common/components/ai-item/types.ts b/packages/blocks/src/_common/components/ai-item/types.ts
index f849d71e5b03..da53dfb49f7e 100644
--- a/packages/blocks/src/_common/components/ai-item/types.ts
+++ b/packages/blocks/src/_common/components/ai-item/types.ts
@@ -30,11 +30,18 @@ abstract class BaseAIError extends Error {
}
export enum AIErrorType {
+ Unauthorized = 'Unauthorized',
PaymentRequired = 'PaymentRequired',
GeneralNetworkError = 'GeneralNetworkError',
}
-// todo: move to presets
+export class UnauthorizedError extends BaseAIError {
+ readonly type = AIErrorType.Unauthorized;
+ constructor() {
+ super('Unauthorized');
+ }
+}
+
// user has used up the quota
export class PaymentRequiredError extends BaseAIError {
readonly type = AIErrorType.PaymentRequired;
@@ -51,4 +58,7 @@ export class GeneralNetworkError extends BaseAIError {
}
}
-export type AIError = PaymentRequiredError | GeneralNetworkError;
+export type AIError =
+ | UnauthorizedError
+ | PaymentRequiredError
+ | GeneralNetworkError;
diff --git a/packages/blocks/src/attachment-block/utils.ts b/packages/blocks/src/attachment-block/utils.ts
index 274086eaf124..455f941b1c38 100644
--- a/packages/blocks/src/attachment-block/utils.ts
+++ b/packages/blocks/src/attachment-block/utils.ts
@@ -84,7 +84,12 @@ async function getAttachmentBlob(model: AttachmentBlockModel) {
}
const doc = model.doc;
- const blob = await doc.blob.get(sourceId);
+ let blob = await doc.blob.get(sourceId);
+
+ if (blob) {
+ blob = new Blob([blob], { type: model.type });
+ }
+
return blob;
}
diff --git a/packages/blocks/src/root-block/widgets/ai-panel/components/state/answer.ts b/packages/blocks/src/root-block/widgets/ai-panel/components/state/answer.ts
index 940f9dc4eccc..014e81503fe6 100644
--- a/packages/blocks/src/root-block/widgets/ai-panel/components/state/answer.ts
+++ b/packages/blocks/src/root-block/widgets/ai-panel/components/state/answer.ts
@@ -28,7 +28,7 @@ export class AIPanelAnswer extends WithDisposable(LitElement) {
box-sizing: border-box;
flex-direction: column;
gap: 8px;
- padding: 12px 8px;
+ padding: 12px 0;
}
.answer {
@@ -39,7 +39,7 @@ export class AIPanelAnswer extends WithDisposable(LitElement) {
gap: 4px;
align-self: stretch;
font-family: ${unsafeCSS(baseTheme.fontSansFamily)};
- padding: 0 8px;
+ padding: 0 12px;
}
.answer-head {
@@ -76,15 +76,14 @@ export class AIPanelAnswer extends WithDisposable(LitElement) {
height: 22px;
align-items: center;
justify-content: space-between;
- gap: 8px;
- padding: 0 8px;
+ padding: 0 12px;
+ gap: 4px;
color: var(--affine-text-secondary-color);
.text {
display: flex;
align-items: flex-start;
- gap: 10px;
flex: 1 0 0;
/* light/xs */
@@ -97,6 +96,7 @@ export class AIPanelAnswer extends WithDisposable(LitElement) {
.right {
display: flex;
align-items: center;
+ padding-right: 8px;
.copy,
.copied {
@@ -124,9 +124,18 @@ export class AIPanelAnswer extends WithDisposable(LitElement) {
gap: 4px;
}
- .response-list-container ai-item-list {
- /* set item style outside ai-item */
+ .response-list-container,
+ .action-list-container {
+ padding: 0 8px;
+ }
+
+ /* set item style outside ai-item */
+ .response-list-container ai-item-list,
+ .action-list-container ai-item-list {
--item-padding: 4px;
+ }
+
+ .response-list-container ai-item-list {
--item-icon-color: var(--affine-icon-secondary);
--item-icon-hover-color: var(--affine-icon-color);
}
@@ -172,16 +181,16 @@ export class AIPanelAnswer extends WithDisposable(LitElement) {
${this.config.responses.length > 0
? html`