Skip to content

Commit

Permalink
fix: missing sessionId
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Apr 11, 2024
1 parent b274db3 commit a349670
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ export function setupAIProvider() {

AIProvider.provideAction('makeItReal', options => {

Check failure on line 122 in packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts

View workflow job for this annotation

GitHub Actions / Lint

Argument of type '"makeItReal"' is not assignable to parameter of type 'keyof AIActions'.
assertExists(options.stream);
const prompt =
'Here are the latest wireframes. Could you make a new website based on these wireframes and notes and send back just the html file?';
const prompt = 'Make it real';
return imageToTextStream({
prompt,
docId: options.docId,
workspaceId: options.workspaceId,
content: options.content,

Check failure on line 129 in packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts

View workflow job for this annotation

GitHub Actions / Lint

Object literal may only specify known properties, and 'content' does not exist in type '{ docId: string; workspaceId: string; prompt: string; params?: string | undefined; attachments?: string[] | undefined; }'.

Check failure on line 129 in packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts

View workflow job for this annotation

GitHub Actions / Lint

Property 'content' does not exist on type 'AITextActionOptions | TranslateOptions | ChangeToneOptions'.
params: options.params,

Check failure on line 130 in packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts

View workflow job for this annotation

GitHub Actions / Lint

Property 'params' does not exist on type 'AITextActionOptions | TranslateOptions | ChangeToneOptions'.
attachments: options.atachments,
prompt,
attachments: options.attachments,

Check failure on line 131 in packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts

View workflow job for this annotation

GitHub Actions / Lint

Property 'attachments' does not exist on type 'AITextActionOptions | TranslateOptions | ChangeToneOptions'.
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ export function imageToTextStream({
const client = new CopilotClient(getBaseUrl());
return {
[Symbol.asyncIterator]: async function* () {
const session = await client.createSession({
const sessionId = await client.createSession({
workspaceId,
docId,
promptName,
});
const message = await client.createMessage(options);
const eventSource = client.textStream(message, session);
const messageId = await client.createMessage({

Check failure on line 50 in packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/request.ts

View workflow job for this annotation

GitHub Actions / Lint

Property 'createMessage' does not exist on type 'CopilotClient'.
sessionId,
...options,
});
const eventSource = client.textStream(messageId, sessionId);

Check failure on line 54 in packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/request.ts

View workflow job for this annotation

GitHub Actions / Lint

Property 'textStream' does not exist on type 'CopilotClient'.
yield* toTextStream(eventSource, { timeout: TIMEOUT });
},
};
Expand All @@ -58,24 +61,29 @@ export function imageToTextStream({
export function imageToImagesStream({
docId,
workspaceId,
prompt: promptName,
...options
}: {
docId: string;
workspaceId: string;
prompt: string;
content: string;
params?: string;
attachments?: string[];
}) {
const client = new CopilotClient(getBaseUrl());
return {
[Symbol.asyncIterator]: async function* () {
const session = await client.createSession({
const sessionId = await client.createSession({
workspaceId,
docId,
promptName: 'Summary', // placeholder
promptName,
});
const messageId = await client.createMessage({

Check failure on line 82 in packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/request.ts

View workflow job for this annotation

GitHub Actions / Lint

Property 'createMessage' does not exist on type 'CopilotClient'.
sessionId,
...options,
});
const message = await client.createMessage(options);
const eventSource = client.imagesStream(message, session);
const eventSource = client.imagesStream(messageId, sessionId);

Check failure on line 86 in packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/request.ts

View workflow job for this annotation

GitHub Actions / Lint

Property 'imagesStream' does not exist on type 'CopilotClient'.
yield* toTextStream(eventSource, { timeout: TIMEOUT });
},
};
Expand Down

0 comments on commit a349670

Please sign in to comment.