refactor: 统一项目名称从OpenFang到ZCLAW
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
重构所有代码和文档中的项目名称,将OpenFang统一更新为ZCLAW。包括: - 配置文件中的项目名称 - 代码注释和文档引用 - 环境变量和路径 - 类型定义和接口名称 - 测试用例和模拟数据 同时优化部分代码结构,移除未使用的模块,并更新相关依赖项。
This commit is contained in:
@@ -10,11 +10,11 @@ import {
|
||||
ConfigParseError,
|
||||
ConfigValidationFailedError,
|
||||
} from '../src/lib/config-parser';
|
||||
import type { OpenFangConfig } from '../src/types/config';
|
||||
import type { ZclawConfig } from '../src/types/config';
|
||||
|
||||
describe('configParser', () => {
|
||||
const validToml = `
|
||||
# Valid OpenFang configuration
|
||||
# Valid ZCLAW configuration
|
||||
[server]
|
||||
host = "127.0.0.1"
|
||||
port = 4200
|
||||
@@ -23,7 +23,7 @@ websocket_port = 4200
|
||||
websocket_path = "/ws"
|
||||
|
||||
[agent.defaults]
|
||||
workspace = "~/.openfang/workspace"
|
||||
workspace = "~/.zclaw/workspace"
|
||||
default_model = "gpt-4"
|
||||
|
||||
[llm]
|
||||
@@ -44,7 +44,7 @@ default_model = "gpt-4"
|
||||
});
|
||||
expect(config.agent).toBeDefined();
|
||||
expect(config.agent.defaults).toEqual({
|
||||
workspace: '~/.openfang/workspace',
|
||||
workspace: '~/.zclaw/workspace',
|
||||
default_model: 'gpt-4',
|
||||
});
|
||||
expect(config.llm).toEqual({
|
||||
@@ -57,14 +57,14 @@ default_model = "gpt-4"
|
||||
|
||||
describe('validateConfig', () => {
|
||||
it('should validate correct configuration', () => {
|
||||
const config: OpenFangConfig = {
|
||||
const config: ZclawConfig = {
|
||||
server: {
|
||||
host: '127.0.0.1',
|
||||
port: 4200,
|
||||
},
|
||||
agent: {
|
||||
defaults: {
|
||||
workspace: '~/.openfang/workspace',
|
||||
workspace: '~/.zclaw/workspace',
|
||||
default_model: 'gpt-4',
|
||||
},
|
||||
},
|
||||
@@ -102,7 +102,7 @@ default_model = "gpt-4"
|
||||
},
|
||||
agent: {
|
||||
defaults: {
|
||||
workspace: '~/.openfang/workspace',
|
||||
workspace: '~/.zclaw/workspace',
|
||||
default_model: 'gpt-4',
|
||||
},
|
||||
},
|
||||
@@ -127,7 +127,7 @@ default_model = "gpt-4"
|
||||
},
|
||||
agent: {
|
||||
defaults: {
|
||||
workspace: '~/.openfang/workspace',
|
||||
workspace: '~/.zclaw/workspace',
|
||||
default_model: '',
|
||||
},
|
||||
},
|
||||
@@ -163,14 +163,14 @@ host = "127.0.0.1"
|
||||
|
||||
describe('stringifyConfig', () => {
|
||||
it('should stringify configuration to TOML', () => {
|
||||
const config: OpenFangConfig = {
|
||||
const config: ZclawConfig = {
|
||||
server: {
|
||||
host: '127.0.0.1',
|
||||
port: 4200,
|
||||
},
|
||||
agent: {
|
||||
defaults: {
|
||||
workspace: '~/.openfang/workspace',
|
||||
workspace: '~/.zclaw/workspace',
|
||||
default_model: 'gpt-4',
|
||||
},
|
||||
},
|
||||
@@ -232,16 +232,16 @@ port = 4200
|
||||
});
|
||||
});
|
||||
|
||||
describe('isOpenFangConfig', () => {
|
||||
describe('isZclawConfig', () => {
|
||||
it('should return true for valid config', () => {
|
||||
const config: OpenFangConfig = {
|
||||
const config: ZclawConfig = {
|
||||
server: {
|
||||
host: '127.0.0.1',
|
||||
port: 4200,
|
||||
},
|
||||
agent: {
|
||||
defaults: {
|
||||
workspace: '~/.openfang/workspace',
|
||||
workspace: '~/.zclaw/workspace',
|
||||
default_model: 'gpt-4',
|
||||
},
|
||||
},
|
||||
@@ -251,12 +251,12 @@ port = 4200
|
||||
},
|
||||
};
|
||||
|
||||
expect(configParser.isOpenFangConfig(config)).toBe(true);
|
||||
expect(configParser.isZclawConfig(config)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for invalid config', () => {
|
||||
expect(configParser.isOpenFangConfig(null)).toBe(false);
|
||||
expect(configParser.isOpenFangConfig({})).toBe(false);
|
||||
expect(configParser.isZclawConfig(null)).toBe(false);
|
||||
expect(configParser.isZclawConfig({})).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user