Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(copilot): change to gpt-4o to default model #1765

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/database/database.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { logLevel1704941582350 } from './migration/1704941582350-logLevel'
import { updatePayloadTypeToVarchar1630403733965 } from './migration/1705478422620-updatePayloadTypeToVarchar'
import { supportOpenAIAPIHost1716044120271 } from './migration/1716044120271-supportOpenAIAPIHost'
import { ignoreQoS0Message1724839386732 } from './migration/1724839386732-ignoreQoS0Message'
import { changeDefaultLLMModel1727111519962 } from './migration/1727111519962-changeDefaultLLMModel'

const STORE_PATH = getAppDataPath('MQTTX')
try {
Expand Down Expand Up @@ -98,6 +99,7 @@ const ORMConfig = {
updatePayloadTypeToVarchar1630403733965,
supportOpenAIAPIHost1716044120271,
ignoreQoS0Message1724839386732,
changeDefaultLLMModel1727111519962,
],
migrationsTableName: 'temp_migration_table',
entities: [
Expand Down
145 changes: 145 additions & 0 deletions src/database/migration/1727111519962-changeDefaultLLMModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import { MigrationInterface, QueryRunner } from 'typeorm'

export class changeDefaultLLMModel1727111519962 implements MigrationInterface {
name = 'changeDefaultLLMModel1727111519962'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
CREATE TABLE "temporary_SettingEntity" (
"id" varchar PRIMARY KEY NOT NULL,
"width" integer NOT NULL DEFAULT (1025),
"height" integer NOT NULL DEFAULT (749),
"autoCheck" boolean NOT NULL DEFAULT (1),
"currentLang" varchar CHECK(currentLang IN ('zh', 'en', 'ja', 'tr', 'hu')) NOT NULL DEFAULT ('en'),
"currentTheme" varchar CHECK(currentTheme IN ('light', 'dark', 'night')) NOT NULL DEFAULT ('light'),
"maxReconnectTimes" integer NOT NULL DEFAULT (10),
"autoResub" boolean NOT NULL DEFAULT (1),
"syncOsTheme" boolean NOT NULL DEFAULT (0),
"multiTopics" boolean NOT NULL DEFAULT (1),
"jsonHighlight" boolean NOT NULL DEFAULT (1),
"openAIAPIKey" varchar NOT NULL DEFAULT (''),
"model" varchar NOT NULL DEFAULT ('gpt-4o'),
"enableCopilot" boolean NOT NULL DEFAULT (1),
"logLevel" varchar CHECK(logLevel IN ('debug', 'info', 'warn', 'error')) NOT NULL DEFAULT ('info'),
"openAIAPIHost" varchar NOT NULL DEFAULT ('https://api.openai.com/v1'),
"ignoreQoS0Message" boolean NOT NULL DEFAULT (0)
)
`)
await queryRunner.query(`
INSERT INTO "temporary_SettingEntity"(
"id",
"width",
"height",
"autoCheck",
"currentLang",
"currentTheme",
"maxReconnectTimes",
"autoResub",
"syncOsTheme",
"multiTopics",
"jsonHighlight",
"openAIAPIKey",
"model",
"enableCopilot",
"logLevel",
"openAIAPIHost",
"ignoreQoS0Message"
)
SELECT "id",
"width",
"height",
"autoCheck",
"currentLang",
"currentTheme",
"maxReconnectTimes",
"autoResub",
"syncOsTheme",
"multiTopics",
"jsonHighlight",
"openAIAPIKey",
"model",
"enableCopilot",
"logLevel",
"openAIAPIHost",
"ignoreQoS0Message"
FROM "SettingEntity"
`)
await queryRunner.query(`
DROP TABLE "SettingEntity"
`)
await queryRunner.query(`
ALTER TABLE "temporary_SettingEntity"
RENAME TO "SettingEntity"
`)
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE "SettingEntity"
RENAME TO "temporary_SettingEntity"
`)
await queryRunner.query(`
CREATE TABLE "SettingEntity" (
"id" varchar PRIMARY KEY NOT NULL,
"width" integer NOT NULL DEFAULT (1025),
"height" integer NOT NULL DEFAULT (749),
"autoCheck" boolean NOT NULL DEFAULT (1),
"currentLang" varchar CHECK(currentLang IN ('zh', 'en', 'ja', 'tr', 'hu')) NOT NULL DEFAULT ('en'),
"currentTheme" varchar CHECK(currentTheme IN ('light', 'dark', 'night')) NOT NULL DEFAULT ('light'),
"maxReconnectTimes" integer NOT NULL DEFAULT (10),
"autoResub" boolean NOT NULL DEFAULT (1),
"syncOsTheme" boolean NOT NULL DEFAULT (0),
"multiTopics" boolean NOT NULL DEFAULT (1),
"jsonHighlight" boolean NOT NULL DEFAULT (1),
"openAIAPIKey" varchar NOT NULL DEFAULT (''),
"model" varchar NOT NULL DEFAULT ('gpt-3.5-turbo'),
"enableCopilot" boolean NOT NULL DEFAULT (1),
"logLevel" varchar CHECK(logLevel IN ('debug', 'info', 'warn', 'error')) NOT NULL DEFAULT ('info'),
"openAIAPIHost" varchar NOT NULL DEFAULT ('https://api.openai.com/v1'),
"ignoreQoS0Message" boolean NOT NULL DEFAULT (0)
)
`)
await queryRunner.query(`
INSERT INTO "SettingEntity"(
"id",
"width",
"height",
"autoCheck",
"currentLang",
"currentTheme",
"maxReconnectTimes",
"autoResub",
"syncOsTheme",
"multiTopics",
"jsonHighlight",
"openAIAPIKey",
"model",
"enableCopilot",
"logLevel",
"openAIAPIHost",
"ignoreQoS0Message"
)
SELECT "id",
"width",
"height",
"autoCheck",
"currentLang",
"currentTheme",
"maxReconnectTimes",
"autoResub",
"syncOsTheme",
"multiTopics",
"jsonHighlight",
"openAIAPIKey",
"model",
"enableCopilot",
"logLevel",
"openAIAPIHost",
"ignoreQoS0Message"
FROM "temporary_SettingEntity"
`)
await queryRunner.query(`
DROP TABLE "temporary_SettingEntity"
`)
}
}
2 changes: 1 addition & 1 deletion src/database/models/SettingEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class SettingEntity {
@Column({ type: 'varchar', default: '' })
openAIAPIKey!: string

@Column({ type: 'varchar', default: 'gpt-3.5-turbo' })
@Column({ type: 'varchar', default: 'gpt-4o' })
model!: string

@Column({ type: 'simple-enum', enum: ['debug', 'info', 'warn', 'error'], default: 'info' })
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const app = {
enableCopilot: settingData.enableCopilot,
openAIAPIHost: settingData.openAIAPIHost || 'https://api.openai.com/v1',
openAIAPIKey: settingData.openAIAPIKey || '',
model: settingData.model || 'gpt-3.5-turbo',
model: settingData.model || 'gpt-4o',
isPrismButtonAdded: false,
logLevel: settingData.logLevel || 'info',
showConnectionList: getShowConnectionList(),
Expand Down
3 changes: 3 additions & 0 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ declare global {
| 'gpt-4-32k-0613'
| 'gpt-4-turbo'
| 'gpt-4o'
| 'gpt-4o-mini'
| 'o1-preview'
| 'o1-mini'
| string

interface AreaLineSeriesData {
Expand Down
14 changes: 12 additions & 2 deletions src/views/settings/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
<el-input
size="mini"
v-model.trim="aiConfig.model"
placeholder="gpt-3.5-turbo"
placeholder="gpt-4o"
type="text"
clearable
:disabled="!enableCopilot"
Expand Down Expand Up @@ -496,12 +496,19 @@ export default class Settings extends Vue {
{ value: 'gpt-4-32k-0613' },
{ value: 'gpt-4-turbo' },
{ value: 'gpt-4o' },
{ value: 'gpt-4o-mini' },
{ value: 'o1-preview' },
{ value: 'o1-mini' },
],
},
{
value: 'Moonshot',
children: [{ value: 'moonshot-v1-8k' }, { value: 'moonshot-v1-32k' }, { value: 'moonshot-v1-128k' }],
},
{
value: 'DeepSeek',
children: [{ value: 'deepseek-chat' }, { value: 'deepseek-coder' }],
},
]
private AIAPIHostOptions = [
{
Expand All @@ -510,6 +517,9 @@ export default class Settings extends Vue {
{
value: 'https://api.moonshot.cn/v1',
},
{
value: 'https://api.deepseek.com/v1',
},
]
private showImportData = false
private showExportData = false
Expand Down Expand Up @@ -588,7 +598,7 @@ export default class Settings extends Vue {
this.actionSetOpenAIAPIKey({ openAIAPIKey: encryptedKey })
break
case 'model':
this.actionSetModel({ model: this.aiConfig.model || 'gpt-3.5-turbo' })
this.actionSetModel({ model: this.aiConfig.model || 'gpt-4o' })
break
case 'host':
this.actionSetOpenAIAPIHost({ openAIAPIHost: this.aiConfig.openAIAPIHost || 'https://api.openai.com/v1' })
Expand Down
Loading