feat: update Makelore modules and conversations
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
inman
2026-07-31 10:08:41 +08:00
parent b8ca3f8eea
commit 80e8386fa6
175 changed files with 8036 additions and 10581 deletions

View File

@@ -1,4 +1,4 @@
import { existsSync, mkdtempSync, rmSync } from 'node:fs';
import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { afterEach, describe, expect, it } from 'vitest';
@@ -33,13 +33,24 @@ afterEach(() => {
});
describe('local image workspace', () => {
it('requires both an unpackaged app and the explicit local mode', () => {
it('routes the default development command through the local workspace adapter', () => {
const packageJson = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8')) as {
scripts: Record<string, string>;
};
expect(packageJson.scripts.dev).toBe('node scripts/run-local-image-workspace-dev.mjs');
expect(packageJson.scripts['dev:image-workspace:local']).toBe('node scripts/run-local-image-workspace-dev.mjs');
});
it('enables local mode for an unpackaged development server and never for packaged apps', () => {
expect(isLocalImageWorkspaceDevelopmentEnabled({ isPackaged: false, configuredMode: 'local' })).toBe(true);
expect(isLocalImageWorkspaceDevelopmentEnabled({ isPackaged: false, configuredMode: undefined })).toBe(false);
expect(isLocalImageWorkspaceDevelopmentEnabled({ isPackaged: false, isDevelopmentServer: true })).toBe(true);
expect(isLocalImageWorkspaceDevelopmentEnabled({ isPackaged: false, isDevelopmentServer: false })).toBe(false);
expect(isLocalImageWorkspaceDevelopmentEnabled({ isPackaged: false, configuredMode: 'cloud', isDevelopmentServer: true })).toBe(false);
expect(isLocalImageWorkspaceDevelopmentEnabled({ isPackaged: true, configuredMode: 'local' })).toBe(false);
});
it('starts empty, persists projects and Agents, and survives a new service instance', async () => {
it('starts without Agents, persists manually added Agents, and survives a new service instance', async () => {
const userDataDir = createTemporaryDirectory();
const service = createService(userDataDir);
@@ -54,13 +65,14 @@ describe('local image workspace', () => {
expect(created.projects).toHaveLength(1);
expect(created.projects[0]).toMatchObject({
name: '本地角色设计',
agents: [{ name: '视觉创作 Agent' }],
agents: [],
messages: [],
});
const withAgent = await service.addAgent(created.projects[0].id);
expect(withAgent.projects[0].agents.map((agent) => agent.name)).toEqual([
'视觉创作 Agent',
const withSecondAgent = await service.addAgent(withAgent.projects[0].id);
expect(withSecondAgent.projects[0].agents.map((agent) => agent.name)).toEqual([
'创作 Agent 1',
'创作 Agent 2',
]);
@@ -75,7 +87,8 @@ describe('local image workspace', () => {
const userDataDir = createTemporaryDirectory();
const service = createService(userDataDir);
const created = await service.createProject('连续创作');
const project = created.projects[0];
const withAgent = await service.addAgent(created.projects[0].id);
const project = withAgent.projects[0];
const agent = project.agents[0];
const upload = await service.uploadReference({
projectId: project.id,
@@ -133,7 +146,8 @@ describe('local image workspace', () => {
const userDataDir = createTemporaryDirectory();
const service = createService(userDataDir);
const created = await service.createProject('可重置项目');
const project = created.projects[0];
const withAgent = await service.addAgent(created.projects[0].id);
const project = withAgent.projects[0];
await expect(service.sendMessage({
projectId: project.id,