mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
@@ -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