@@ -29,7 +29,7 @@ export async function createApp() {
|
|||||||
graphqlUploadExpress({
|
graphqlUploadExpress({
|
||||||
// TODO(@darkskygit): dynamic limit by quota maybe?
|
// TODO(@darkskygit): dynamic limit by quota maybe?
|
||||||
maxFileSize: 100 * 1024 * 1024,
|
maxFileSize: 100 * 1024 * 1024,
|
||||||
maxFiles: 5,
|
maxFiles: 32,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -233,6 +233,7 @@ export class OpenAIProvider
|
|||||||
options: CopilotChatOptions = {}
|
options: CopilotChatOptions = {}
|
||||||
): AsyncIterable<string> {
|
): AsyncIterable<string> {
|
||||||
this.checkParams({ messages, model, options });
|
this.checkParams({ messages, model, options });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await this.instance.chat.completions.create(
|
const result = await this.instance.chat.completions.create(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -283,7 +283,13 @@ export class ChatSessionService {
|
|||||||
docId: true,
|
docId: true,
|
||||||
parentSessionId: true,
|
parentSessionId: true,
|
||||||
messages: {
|
messages: {
|
||||||
select: { id: true, role: true, content: true, createdAt: true },
|
select: {
|
||||||
|
id: true,
|
||||||
|
role: true,
|
||||||
|
content: true,
|
||||||
|
attachments: true,
|
||||||
|
createdAt: true,
|
||||||
|
},
|
||||||
orderBy: { createdAt: 'asc' },
|
orderBy: { createdAt: 'asc' },
|
||||||
},
|
},
|
||||||
promptName: true,
|
promptName: true,
|
||||||
|
|||||||
@@ -246,14 +246,16 @@ test('should be able to manage chat session', async t => {
|
|||||||
|
|
||||||
const s1 = (await session.get(sessionId))!;
|
const s1 = (await session.get(sessionId))!;
|
||||||
t.deepEqual(
|
t.deepEqual(
|
||||||
// @ts-expect-error
|
s1
|
||||||
s1.finish(params).map(({ id: _, createdAt: __, ...m }) => m),
|
.finish(params)
|
||||||
|
// @ts-expect-error
|
||||||
|
.map(({ id: _, attachments: __, createdAt: ___, ...m }) => m),
|
||||||
finalMessages,
|
finalMessages,
|
||||||
'should same as before message'
|
'should same as before message'
|
||||||
);
|
);
|
||||||
t.deepEqual(
|
t.deepEqual(
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
s1.finish({}).map(({ id: _, createdAt: __, ...m }) => m),
|
s1.finish({}).map(({ id: _, attachments: __, createdAt: ___, ...m }) => m),
|
||||||
[
|
[
|
||||||
{ content: 'hello ', params: {}, role: 'system' },
|
{ content: 'hello ', params: {}, role: 'system' },
|
||||||
{ content: 'hello', role: 'user' },
|
{ content: 'hello', role: 'user' },
|
||||||
@@ -325,7 +327,7 @@ test('should be able to fork chat session', async t => {
|
|||||||
|
|
||||||
const finalMessages = s2
|
const finalMessages = s2
|
||||||
.finish(params) // @ts-expect-error
|
.finish(params) // @ts-expect-error
|
||||||
.map(({ id: _, createdAt: __, ...m }) => m);
|
.map(({ id: _, attachments: __, createdAt: ___, ...m }) => m);
|
||||||
t.deepEqual(
|
t.deepEqual(
|
||||||
finalMessages,
|
finalMessages,
|
||||||
[
|
[
|
||||||
@@ -346,7 +348,7 @@ test('should be able to fork chat session', async t => {
|
|||||||
|
|
||||||
const finalMessages = s2
|
const finalMessages = s2
|
||||||
.finish(params) // @ts-expect-error
|
.finish(params) // @ts-expect-error
|
||||||
.map(({ id: _, createdAt: __, ...m }) => m);
|
.map(({ id: _, attachments: __, createdAt: ___, ...m }) => m);
|
||||||
t.deepEqual(
|
t.deepEqual(
|
||||||
finalMessages,
|
finalMessages,
|
||||||
[
|
[
|
||||||
@@ -364,7 +366,7 @@ test('should be able to fork chat session', async t => {
|
|||||||
|
|
||||||
const finalMessages = s3
|
const finalMessages = s3
|
||||||
.finish(params) // @ts-expect-error
|
.finish(params) // @ts-expect-error
|
||||||
.map(({ id: _, createdAt: __, ...m }) => m);
|
.map(({ id: _, attachments: __, createdAt: ___, ...m }) => m);
|
||||||
t.deepEqual(
|
t.deepEqual(
|
||||||
finalMessages,
|
finalMessages,
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { reportResponse } from '../utils/action-reporter';
|
|||||||
import { readBlobAsURL } from '../utils/image';
|
import { readBlobAsURL } from '../utils/image';
|
||||||
import type { ChatContextValue, ChatMessage } from './chat-context';
|
import type { ChatContextValue, ChatMessage } from './chat-context';
|
||||||
|
|
||||||
const MaximumImageCount = 8;
|
const MaximumImageCount = 32;
|
||||||
|
|
||||||
function getFirstTwoLines(text: string) {
|
function getFirstTwoLines(text: string) {
|
||||||
const lines = text.split('\n');
|
const lines = text.split('\n');
|
||||||
|
|||||||
Reference in New Issue
Block a user