mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 18:02:47 +08:00
feat(server): copilot session prompt query (#10479)
This commit is contained in:
@@ -301,11 +301,11 @@ declare global {
|
||||
docId: string,
|
||||
promptName?: string
|
||||
) => Promise<string>;
|
||||
getSessionIds: (
|
||||
getSessions: (
|
||||
workspaceId: string,
|
||||
docId?: string,
|
||||
options?: { action?: boolean }
|
||||
) => Promise<string[] | undefined>;
|
||||
) => Promise<{ id: string; promptName: string }[] | undefined>;
|
||||
updateSession: (sessionId: string, promptName: string) => Promise<string>;
|
||||
}
|
||||
|
||||
|
||||
@@ -300,12 +300,12 @@ export class ChatPanel extends WithDisposable(ShadowlessElement) {
|
||||
const userId = (await AIProvider.userInfo)?.id;
|
||||
if (!userId) return;
|
||||
|
||||
const sessionIds = await AIProvider.session?.getSessionIds(
|
||||
const sessions = await AIProvider.session?.getSessions(
|
||||
this.doc.workspace.id,
|
||||
this.doc.id
|
||||
);
|
||||
if (sessionIds?.length) {
|
||||
this._chatSessionId = sessionIds[0];
|
||||
if (sessions?.length) {
|
||||
this._chatSessionId = sessions?.[0].id;
|
||||
await this._updateHistory();
|
||||
}
|
||||
if (this._chatSessionId) {
|
||||
|
||||
@@ -136,7 +136,7 @@ export class CopilotClient {
|
||||
}
|
||||
}
|
||||
|
||||
async getSessionIds(
|
||||
async getSessions(
|
||||
workspaceId: string,
|
||||
docId?: string,
|
||||
options?: RequestOptions<
|
||||
@@ -152,7 +152,7 @@ export class CopilotClient {
|
||||
options,
|
||||
},
|
||||
});
|
||||
return res.currentUser?.copilot?.sessionIds;
|
||||
return res.currentUser?.copilot?.sessions;
|
||||
} catch (err) {
|
||||
throw resolveError(err);
|
||||
}
|
||||
|
||||
@@ -408,12 +408,12 @@ Could you make a new website based on these notes and send back just the html fi
|
||||
promptName,
|
||||
});
|
||||
},
|
||||
getSessionIds: async (
|
||||
getSessions: async (
|
||||
workspaceId: string,
|
||||
docId?: string,
|
||||
options?: { action?: boolean }
|
||||
) => {
|
||||
return client.getSessionIds(workspaceId, docId, options);
|
||||
return client.getSessions(workspaceId, docId, options);
|
||||
},
|
||||
updateSession: async (sessionId: string, promptName: string) => {
|
||||
return client.updateSession({
|
||||
|
||||
Reference in New Issue
Block a user