mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat(core): support ai network search (#9357)
### What Changed?
- Add `PerplexityProvider` in backend.
- Update session prompt name if user toggle network search mode in chat panel.
- Add experimental flag for AI network search feature.
- Add unit tests and e2e tests.
Search results are streamed and appear word for word:
<div class='graphite__hidden'>
<div>🎥 Video uploaded on Graphite:</div>
<a href="https://app.graphite.dev/media/video/sJGviKxfE3Ap685cl5bj/56f6ec7b-4b21-405f-9612-43e083f6fb84.mov">
<img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/sJGviKxfE3Ap685cl5bj/56f6ec7b-4b21-405f-9612-43e083f6fb84.mov">
</a>
</div>
<video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/56f6ec7b-4b21-405f-9612-43e083f6fb84.mov">录屏2024-12-27 18.58.40.mov</video>
Click the little globe icon to manually turn on/off Internet search:
<div class='graphite__hidden'>
<div>🎥 Video uploaded on Graphite:</div>
<a href="https://app.graphite.dev/media/video/sJGviKxfE3Ap685cl5bj/778f1406-bf29-498e-a90d-7dad813392d1.mov">
<img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/sJGviKxfE3Ap685cl5bj/778f1406-bf29-498e-a90d-7dad813392d1.mov">
</a>
</div>
<video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/778f1406-bf29-498e-a90d-7dad813392d1.mov">录屏2024-12-27 19.01.16.mov</video>
When there is an image, it will automatically switch to the openai model:
<div class='graphite__hidden'>
<div>🎥 Video uploaded on Graphite:</div>
<a href="https://app.graphite.dev/media/video/sJGviKxfE3Ap685cl5bj/56431d8e-75e1-4d84-ab4a-b6636042cc6a.mov">
<img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/sJGviKxfE3Ap685cl5bj/56431d8e-75e1-4d84-ab4a-b6636042cc6a.mov">
</a>
</div>
<video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/56431d8e-75e1-4d84-ab4a-b6636042cc6a.mov">录屏2024-12-27 19.02.13.mov</video>
This commit is contained in:
@@ -206,6 +206,17 @@ mutation createCopilotSession($options: CreateChatSessionInput!) {
|
||||
}`,
|
||||
};
|
||||
|
||||
export const updateCopilotSessionMutation = {
|
||||
id: 'updateCopilotSessionMutation' as const,
|
||||
operationName: 'updateCopilotSession',
|
||||
definitionName: 'updateCopilotSession',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation updateCopilotSession($options: UpdateChatSessionInput!) {
|
||||
updateCopilotSession(options: $options)
|
||||
}`,
|
||||
};
|
||||
|
||||
export const createCustomerPortalMutation = {
|
||||
id: 'createCustomerPortalMutation' as const,
|
||||
operationName: 'createCustomerPortal',
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
mutation updateCopilotSession($options: UpdateChatSessionInput!) {
|
||||
updateCopilotSession(options: $options)
|
||||
}
|
||||
@@ -188,6 +188,11 @@ export interface CreateChatSessionInput {
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface UpdateChatSessionInput {
|
||||
sessionId: Scalars['String']['input'];
|
||||
promptName: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface CreateCheckoutSessionInput {
|
||||
args?: InputMaybe<Scalars['JSONObject']['input']>;
|
||||
coupon?: InputMaybe<Scalars['String']['input']>;
|
||||
@@ -688,6 +693,10 @@ export interface MutationCreateCopilotSessionArgs {
|
||||
options: CreateChatSessionInput;
|
||||
}
|
||||
|
||||
export interface MutationUpdateCopilotSessionArgs {
|
||||
options: UpdateChatSessionInput;
|
||||
}
|
||||
|
||||
export interface MutationCreateInviteLinkArgs {
|
||||
expireTime: WorkspaceInviteLinkExpireTime;
|
||||
workspaceId: Scalars['String']['input'];
|
||||
@@ -1596,6 +1605,15 @@ export type CreateCopilotSessionMutation = {
|
||||
createCopilotSession: string;
|
||||
};
|
||||
|
||||
export type UpdateCopilotSessionMutationVariables = Exact<{
|
||||
options: UpdateChatSessionInput;
|
||||
}>;
|
||||
|
||||
export type UpdateCopilotSessionMutation = {
|
||||
__typename?: 'Mutation';
|
||||
updateCopilotSession: string;
|
||||
};
|
||||
|
||||
export type CreateCustomerPortalMutationVariables = Exact<{
|
||||
[key: string]: never;
|
||||
}>;
|
||||
@@ -3070,6 +3088,11 @@ export type Mutations =
|
||||
variables: CreateCopilotSessionMutationVariables;
|
||||
response: CreateCopilotSessionMutation;
|
||||
}
|
||||
| {
|
||||
name: 'updateCopilotSessionMutation';
|
||||
variables: UpdateCopilotSessionMutationVariables;
|
||||
response: UpdateCopilotSessionMutation;
|
||||
}
|
||||
| {
|
||||
name: 'createCustomerPortalMutation';
|
||||
variables: CreateCustomerPortalMutationVariables;
|
||||
|
||||
Reference in New Issue
Block a user