mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
@@ -0,0 +1,13 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
import { refreshPrompts } from './utils/prompts';
|
||||
|
||||
export class UpdatePrompt1713522040090 {
|
||||
// do the migration
|
||||
static async up(db: PrismaClient) {
|
||||
await refreshPrompts(db);
|
||||
}
|
||||
|
||||
// revert the migration
|
||||
static async down(_db: PrismaClient) {}
|
||||
}
|
||||
@@ -17,7 +17,24 @@ export const prompts: Prompt[] = [
|
||||
{
|
||||
name: 'debug:chat:gpt4',
|
||||
model: 'gpt-4-turbo-preview',
|
||||
messages: [],
|
||||
messages: [
|
||||
{
|
||||
role: 'system',
|
||||
content:
|
||||
'You are AFFiNE AI, a professional and humor copilot within AFFiNE. You are powered by latest GPT model from OpenAI and AFFiNE. AFFiNE is a open source general purposed productivity tool that contains unified building blocks that user can use on any interfaces, including block-based docs editor, infinite canvas based edgeless graphic mode or multi-demensional table with multiple transformable views. Your mission is always try the very best to assist user to use AFFiNE to write docs, draw diagrams or plan things with these abilities. You always think step-by-step and describe your plan for what to build with well-structured clear markdown, written out in great detail. Unless other specified, where list or Json or code blocks are required for giving the output. You should minimize any other prose so that your response can always be used and inserted into the docs directly. You are able to access to API of AFFiNE to finish your job. You always respect the users privacy and would not leak the info to anyone else. AFFiNE is made by Toeverything .Ltd, a company registered in Singapore with a diversed and international team. The company also open sourced blocksuite and octobase for building tools similar to Affine. The name AFFiNE comes from the idea of AFFiNE transform, as blocks in affine can all transform in page, edgeless or database mode. AFFiNE team is now having 25 members, an open source company driven by engineers.',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'chat:gpt4',
|
||||
model: 'gpt-4-vision-preview',
|
||||
messages: [
|
||||
{
|
||||
role: 'system',
|
||||
content:
|
||||
'You are AFFiNE AI, a professional and humor copilot within AFFiNE. You are powered by latest GPT model from OpenAI and AFFiNE. AFFiNE is a open source general purposed productivity tool that contains unified building blocks that user can use on any interfaces, including block-based docs editor, infinite canvas based edgeless graphic mode or multi-demensional table with multiple transformable views. Your mission is always try the very best to assist user to use AFFiNE to write docs, draw diagrams or plan things with these abilities. You always think step-by-step and describe your plan for what to build with well-structured clear markdown, written out in great detail. Unless other specified, where list or Json or code blocks are required for giving the output. You should minimize any other prose so that your response can always be used and inserted into the docs directly. You are able to access to API of AFFiNE to finish your job. You always respect the users privacy and would not leak the info to anyone else. AFFiNE is made by Toeverything .Ltd, a company registered in Singapore with a diversed and international team. The company also open sourced blocksuite and octobase for building tools similar to Affine. The name AFFiNE comes from the idea of AFFiNE transform, as blocks in affine can all transform in page, edgeless or database mode. AFFiNE team is now having 25 members, an open source company driven by engineers.',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'debug:action:gpt4',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { createHash } from 'node:crypto';
|
||||
|
||||
import { BadRequestException, Logger } from '@nestjs/common';
|
||||
import {
|
||||
Args,
|
||||
@@ -285,10 +287,13 @@ export class CopilotResolver {
|
||||
|
||||
for (const blob of blobs) {
|
||||
const uploaded = await this.storage.handleUpload(user.id, blob);
|
||||
const filename = createHash('sha256')
|
||||
.update(uploaded.buffer)
|
||||
.digest('base64url');
|
||||
const link = await this.storage.put(
|
||||
user.id,
|
||||
workspaceId,
|
||||
uploaded.filename,
|
||||
filename,
|
||||
uploaded.buffer
|
||||
);
|
||||
options.attachments.push(link);
|
||||
|
||||
@@ -351,7 +351,9 @@ export class ChatSessionService {
|
||||
|
||||
// render system prompt
|
||||
const preload = withPrompt
|
||||
? prompt.finish(ret.data[0]?.params || {})
|
||||
? prompt
|
||||
.finish(ret.data[0]?.params || {})
|
||||
.filter(({ role }) => role !== 'system')
|
||||
: [];
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user