mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 07:06:28 +08:00
64fb3a7243
close AI-246, AI-285 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit * **New Features** * Introduced an AI chat interface accessible from the sidebar with a dedicated "/chat" route. * Added "AFFiNE Intelligent" button with AI icon to the sidebar for quick chat access. * Enhanced chat components with an "independent mode" for improved message display and layout. * Improved chat input and content styling, including responsive layout and onboarding offset support. * **Improvements** * Expanded icon support to include an AI icon in the app. * Updated utility and schema functions for greater flexibility and error prevention. * Added a new chat container style for consistent layout and max width. * **Bug Fixes** * Prevented potential errors when certain editor hosts are not provided. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
87 lines
2.6 KiB
TypeScript
87 lines
2.6 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const workbenchViewIconNameSchema = z.enum([
|
|
'trash',
|
|
'allDocs',
|
|
'collection',
|
|
'tag',
|
|
'doc', // refers to a doc whose mode is not yet being resolved
|
|
'page',
|
|
'edgeless',
|
|
'journal',
|
|
'attachment',
|
|
'pdf',
|
|
'ai',
|
|
]);
|
|
|
|
export const workbenchViewMetaSchema = z.object({
|
|
id: z.string(),
|
|
path: z
|
|
.object({
|
|
pathname: z.string().optional(),
|
|
hash: z.string().optional(),
|
|
search: z.string().optional(),
|
|
})
|
|
.optional(),
|
|
// todo: move title/module to cached stated
|
|
title: z.string().optional(),
|
|
iconName: workbenchViewIconNameSchema.optional(),
|
|
});
|
|
|
|
export const workbenchMetaSchema = z.object({
|
|
id: z.string(),
|
|
activeViewIndex: z.number(),
|
|
pinned: z.boolean().optional(),
|
|
basename: z.string(),
|
|
views: z.array(workbenchViewMetaSchema),
|
|
});
|
|
|
|
export const tabViewsMetaSchema = z.object({
|
|
activeWorkbenchId: z.string().optional(),
|
|
workbenches: z.array(workbenchMetaSchema).default([]),
|
|
});
|
|
|
|
export const TabViewsMetaKey = 'tabViewsMetaSchema';
|
|
export type TabViewsMetaSchema = z.infer<typeof tabViewsMetaSchema>;
|
|
export type WorkbenchMeta = z.infer<typeof workbenchMetaSchema>;
|
|
export type WorkbenchViewMeta = z.infer<typeof workbenchViewMetaSchema>;
|
|
export type WorkbenchViewModule = z.infer<typeof workbenchViewIconNameSchema>;
|
|
|
|
export const SpellCheckStateSchema = z.object({
|
|
enabled: z.boolean().optional(),
|
|
});
|
|
|
|
export const SpellCheckStateKey = 'spellCheckState' as const;
|
|
// oxlint-disable-next-line no-redeclare
|
|
export type SpellCheckStateSchema = z.infer<typeof SpellCheckStateSchema>;
|
|
|
|
export const MenubarStateKey = 'menubarState' as const;
|
|
export const MenubarStateSchema = z.object({
|
|
enabled: z.boolean().default(true),
|
|
});
|
|
|
|
export type MenubarStateSchema = z.infer<typeof MenubarStateSchema>;
|
|
|
|
export const MeetingSettingsKey = 'meetingSettings' as const;
|
|
export const MeetingSettingsSchema = z.object({
|
|
// global meeting feature control
|
|
enabled: z.boolean().default(false),
|
|
|
|
// if false (and enabled = false), show a prompt page
|
|
betaDisclaimerAccepted: z.boolean().default(false),
|
|
|
|
// when recording is saved, where to create the recording block
|
|
recordingSavingMode: z.enum(['new-doc', 'journal-today']).default('new-doc'),
|
|
|
|
// whether to enable generation of summary for new meeting recordings
|
|
autoTranscriptionSummary: z.boolean().default(true),
|
|
|
|
// whether to enable generation of todo list for new meeting recordings
|
|
autoTranscriptionTodo: z.boolean().default(true),
|
|
|
|
// recording reactions to new meeting events
|
|
recordingMode: z.enum(['none', 'prompt', 'auto-start']).default('prompt'),
|
|
});
|
|
|
|
export type MeetingSettingsSchema = z.infer<typeof MeetingSettingsSchema>;
|