BlockSuite API Documentation / @blocksuite/presets / AIProvider
Class: AIProvider
AI provider for the block suite
To use it, downstream (affine) has to provide AI actions implementation, user info etc
todo: breakdown into different parts?
Constructors
new AIProvider(undefined)
new AIProvider():
AIProvider
Returns
Properties
actions
private
readonly
actions:Partial
<AIActions
> ={}
Source
packages/presets/src/ai/provider.ts:21
histories
private
histories:null
|AIHistoryService
=null
Source
packages/presets/src/ai/provider.ts:25
photoEngine
private
photoEngine:null
|AIPhotoEngineService
=null
Source
packages/presets/src/ai/provider.ts:24
slots
private
readonly
slots:object
requestContinueInChat
requestContinueInChat:
Slot
<object
>
Type declaration
host
host:
EditorHost
show
show:
boolean
requestUpgradePlan
requestUpgradePlan:
Slot
<object
>
Type declaration
host
host:
EditorHost
Source
packages/presets/src/ai/provider.ts:26
userInfoFn()
private
userInfoFn: () =>null
|AIUserInfo
|Promise
<AIUserInfo
>
Returns
null
| AIUserInfo
| Promise
<AIUserInfo
>
Source
packages/presets/src/ai/provider.ts:22
instance
private
static
readonly
instance:AIProvider
Source
packages/presets/src/ai/provider.ts:20
Accessors
actions
get
static
actions():Partial
<AIActions
>
Returns
Partial
<AIActions
>
Source
packages/presets/src/ai/provider.ts:89
histories
get
static
histories():null
|AIHistoryService
Returns
null
| AIHistoryService
Source
packages/presets/src/ai/provider.ts:101
photoEngine
get
static
photoEngine():null
|AIPhotoEngineService
Returns
null
| AIPhotoEngineService
Source
packages/presets/src/ai/provider.ts:97
slots
get
static
slots():object
Returns
object
requestContinueInChat
requestContinueInChat:
Slot
<object
>
Type declaration
host
host:
EditorHost
show
show:
boolean
requestUpgradePlan
requestUpgradePlan:
Slot
<object
>
Type declaration
host
host:
EditorHost
Source
packages/presets/src/ai/provider.ts:85
userInfo
get
static
userInfo():null
|AIUserInfo
|Promise
<AIUserInfo
>
Returns
null
| AIUserInfo
| Promise
<AIUserInfo
>
Source
packages/presets/src/ai/provider.ts:93
Methods
provideAction()
private
provideAction<T
>(id
,action
):void
Type parameters
• T extends keyof AIActions
Parameters
• id: T
• action
Returns
void
Source
packages/presets/src/ai/provider.ts:72
provide()
provide(id, fn)
static
provide(id
,fn
):void
Parameters
• id: "userInfo"
• fn
Returns
void
Source
packages/presets/src/ai/provider.ts:34
provide(id, service)
static
provide(id
,service
):void
Parameters
• id: "histories"
• service: AIHistoryService
Returns
void
Source
packages/presets/src/ai/provider.ts:39
provide(id, engine)
static
provide(id
,engine
):void
Parameters
• id: "photoEngine"
• engine: AIPhotoEngineService
Returns
void
Source
packages/presets/src/ai/provider.ts:44
provide(id, action)
static
provide<T
>(id
,action
):void
Type parameters
• T extends keyof AIActions
Parameters
• id: T
• action
Returns
void
Source
packages/presets/src/ai/provider.ts:50