feat(server): upgrade models to gpt4.1 (#11696)

This commit is contained in:
darkskygit
2025-04-15 14:23:40 +00:00
parent 220087c172
commit e0970daa5a
7 changed files with 50 additions and 34 deletions

View File

@@ -461,8 +461,9 @@ const actions = [
],
verifier: (t: ExecutionContext<Tester>, result: string) => {
assertNotWrappedInCodeBlock(t, result);
const cleared = result.toLowerCase();
t.assert(
result.toLowerCase().includes('单一事实来源'),
cleared.includes('单一') || cleared.includes('SSOT'),
'explain code result should include keyword'
);
},

View File

@@ -17,6 +17,9 @@ export class MockCopilotProvider extends OpenAIProvider {
'test',
'gpt-4o',
'gpt-4o-2024-08-06',
'gpt-4.1',
'gpt-4.1-2025-04-14',
'gpt-4.1-mini',
'fast-sdxl/image-to-image',
'lcm-sd15-i2i',
'clarity-upscaler',
@@ -47,7 +50,7 @@ export class MockCopilotProvider extends OpenAIProvider {
override async *generateTextStream(
messages: PromptMessage[],
model: string = 'gpt-4o-mini',
model: string = 'gpt-4.1-mini',
options: CopilotChatOptions = {}
): AsyncIterable<string> {
this.checkParams({ messages, model, options });

View File

@@ -142,7 +142,7 @@ const workflows: Prompt[] = [
{
name: 'workflow:image-sketch:step2',
action: 'workflow:image-sketch:step2',
model: 'gpt-4o-mini-2024-07-18',
model: 'gpt-4.1-mini',
messages: [
{
role: 'system',
@@ -179,7 +179,7 @@ const workflows: Prompt[] = [
{
name: 'workflow:image-clay:step2',
action: 'workflow:image-clay:step2',
model: 'gpt-4o-mini-2024-07-18',
model: 'gpt-4.1-mini',
messages: [
{
role: 'system',
@@ -216,7 +216,7 @@ const workflows: Prompt[] = [
{
name: 'workflow:image-anime:step2',
action: 'workflow:image-anime:step2',
model: 'gpt-4o-mini-2024-07-18',
model: 'gpt-4.1-mini',
messages: [
{
role: 'system',
@@ -253,7 +253,7 @@ const workflows: Prompt[] = [
{
name: 'workflow:image-pixel:step2',
action: 'workflow:image-pixel:step2',
model: 'gpt-4o-mini-2024-07-18',
model: 'gpt-4.1-mini',
messages: [
{
role: 'system',
@@ -355,7 +355,7 @@ Convert a multi-speaker audio recording into a structured JSON format by transcr
{
name: 'Generate a caption',
action: 'Generate a caption',
model: 'gpt-4o-mini-2024-07-18',
model: 'gpt-4.1-mini',
messages: [
{
role: 'user',
@@ -367,7 +367,7 @@ Convert a multi-speaker audio recording into a structured JSON format by transcr
{
name: 'Summary',
action: 'Summary',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -384,7 +384,7 @@ Convert a multi-speaker audio recording into a structured JSON format by transcr
{
name: 'Summary as title',
action: 'Summary as title',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -401,7 +401,7 @@ Convert a multi-speaker audio recording into a structured JSON format by transcr
{
name: 'Summary the webpage',
action: 'Summary the webpage',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'user',
@@ -413,7 +413,7 @@ Convert a multi-speaker audio recording into a structured JSON format by transcr
{
name: 'Explain this',
action: 'Explain this',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -429,7 +429,7 @@ Convert a multi-speaker audio recording into a structured JSON format by transcr
{
name: 'Explain this image',
action: 'Explain this image',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -446,7 +446,7 @@ Convert a multi-speaker audio recording into a structured JSON format by transcr
{
name: 'Explain this code',
action: 'Explain this code',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -463,7 +463,7 @@ Convert a multi-speaker audio recording into a structured JSON format by transcr
{
name: 'Translate to',
action: 'Translate',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -508,7 +508,7 @@ Convert a multi-speaker audio recording into a structured JSON format by transcr
{
name: 'Write an article about this',
action: 'Write an article about this',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -536,7 +536,7 @@ Rules to follow:
{
name: 'Write a twitter about this',
action: 'Write a twitter about this',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -553,7 +553,7 @@ Rules to follow:
{
name: 'Write a poem about this',
action: 'Write a poem about this',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -570,7 +570,7 @@ Rules to follow:
{
name: 'Write a blog post about this',
action: 'Write a blog post about this',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -586,7 +586,7 @@ Rules to follow:
{
name: 'Write outline',
action: 'Write outline',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -603,7 +603,7 @@ Rules to follow:
{
name: 'Change tone to',
action: 'Change tone',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -702,7 +702,7 @@ Rules to follow:
{
name: 'Improve writing for it',
action: 'Improve writing for it',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -718,7 +718,7 @@ Rules to follow:
{
name: 'Improve grammar for it',
action: 'Improve grammar for it',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -734,7 +734,7 @@ Rules to follow:
{
name: 'Fix spelling for it',
action: 'Fix spelling for it',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -750,7 +750,7 @@ Rules to follow:
{
name: 'Find action items from it',
action: 'Find action items from it',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -774,7 +774,7 @@ If there are items in the content that can be used as to-do tasks, please refer
{
name: 'Check code error',
action: 'Check code error',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -824,7 +824,7 @@ If there are items in the content that can be used as to-do tasks, please refer
{
name: 'Make it real',
action: 'Make it real',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -865,7 +865,7 @@ When sent new wireframes, respond ONLY with the contents of the html file.`,
{
name: 'Make it real with text',
action: 'Make it real with text',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -900,7 +900,7 @@ When sent new notes, respond ONLY with the contents of the html file.`,
{
name: 'Make it longer',
action: 'Make it longer',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -928,7 +928,7 @@ Output: Generate a new version of the provided content that is longer in length
{
name: 'Make it shorter',
action: 'Make it shorter',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -955,7 +955,7 @@ Finally, you should present the final, shortened content as your response. Make
{
name: 'Continue writing',
action: 'Continue writing',
model: 'gpt-4o-2024-08-06',
model: 'gpt-4.1-2025-04-14',
messages: [
{
role: 'system',
@@ -984,7 +984,7 @@ Finally, please only send us the content of your continuation in Markdown Format
const chat: Prompt[] = [
{
name: 'debug:chat:gpt4',
model: 'gpt-4o',
model: 'gpt-4.1',
messages: [
{
role: 'system',
@@ -995,7 +995,7 @@ const chat: Prompt[] = [
},
{
name: 'Chat With AFFiNE AI',
model: 'gpt-4o',
model: 'gpt-4.1',
messages: [
{
role: 'system',

View File

@@ -62,6 +62,9 @@ export class OpenAIProvider
'gpt-4o-2024-08-06',
'gpt-4o-mini',
'gpt-4o-mini-2024-07-18',
'gpt-4.1',
'gpt-4.1-2025-04-14',
'gpt-4.1-mini',
'o1',
'o3-mini',
// embeddings
@@ -176,7 +179,7 @@ export class OpenAIProvider
// ====== text to text ======
async generateText(
messages: PromptMessage[],
model: string = 'gpt-4o-mini',
model: string = 'gpt-4.1-mini',
options: CopilotChatOptions = {}
): Promise<string> {
await this.checkParams({ messages, model, options });
@@ -221,7 +224,7 @@ export class OpenAIProvider
async *generateTextStream(
messages: PromptMessage[],
model: string = 'gpt-4o-mini',
model: string = 'gpt-4.1-mini',
options: CopilotChatOptions = {}
): AsyncIterable<string> {
await this.checkParams({ messages, model, options });

View File

@@ -11,6 +11,9 @@ export enum AvailableModels {
Gpt4Omni0806 = 'gpt-4o-2024-08-06',
Gpt4OmniMini = 'gpt-4o-mini',
Gpt4OmniMini0718 = 'gpt-4o-mini-2024-07-18',
Gpt41 = 'gpt-4.1',
Gpt410414 = 'gpt-4.1-2025-04-14',
Gpt41Mini = 'gpt-4.1-mini',
// embeddings
TextEmbedding3Large = 'text-embedding-3-large',
TextEmbedding3Small = 'text-embedding-3-small',

View File

@@ -195,6 +195,9 @@ enum CopilotModels {
Gpt4Omni0806
Gpt4OmniMini
Gpt4OmniMini0718
Gpt41
Gpt41Mini
Gpt410414
TextEmbedding3Large
TextEmbedding3Small
TextEmbeddingAda002

View File

@@ -279,6 +279,9 @@ export enum CopilotModels {
Gpt4Omni0806 = 'Gpt4Omni0806',
Gpt4OmniMini = 'Gpt4OmniMini',
Gpt4OmniMini0718 = 'Gpt4OmniMini0718',
Gpt41 = 'Gpt41',
Gpt41Mini = 'Gpt41Mini',
Gpt410414 = 'Gpt410414',
TextEmbedding3Large = 'TextEmbedding3Large',
TextEmbedding3Small = 'TextEmbedding3Small',
TextEmbeddingAda002 = 'TextEmbeddingAda002',