diff --git a/_fixtures/domain-language/sample.csv b/_fixtures/domain-language/sample.csv new file mode 100644 index 0000000..8d35c03 --- /dev/null +++ b/_fixtures/domain-language/sample.csv @@ -0,0 +1,30 @@ +native,english,abbreviation,description +本币,Domestic Currency,DCY,国家或地区的官方货币。 +汇率,Exchange Rate,ER,一种货币与另一种货币之间的相对价值。 +货币对,Currency Pair,CP,两种货币的组合,用于外汇交易。 +利率,Interest Rate,IR,资金借贷的成本或回报率。 +资产,Asset,-,具有价值的资源或投资。 +负债,Liability,-,企业或个人欠他人的债务。 +股票,Stock,-,公司的所有权证明,可以在证券市场上交易。 +债券,Bond,-,债务工具,代表借款人欠债务持有人的债务。 +期权,Option,-,购买或出售某项资产的权利,但非义务。 +期货,Futures,-,买卖标准化合约,以特定价格和日期交割。 +投资组合,Portfolio,-,持有的所有投资工具的集合。 +风险,Risk,-,不确定事件可能对投资造成的损失。 +收益率,Yield,-,投资所产生的收入与投资成本之间的比率。 +资金流,Cash Flow,CF,在一段时间内进出账户的资金总额。 +资产配置,Asset Allocation,AA,将资金分配给不同种类资产以实现目标。 +财务报表,Financial Statement,FS,描述企业财务状况和业绩的文件,如资产负债表。 +储蓄,Savings,-,收入中未用于消费的部分,通常存放在银行中。 +抵押,Mortgage,-,以房地产等为抵押所获得的借款。 +养老金,Pension,-,退休时期的资金收入,通常通过雇主或政府提供。 +创业资金,Venture Capital,VC,为初创企业提供资金的投资者。 +派息,Dividend,-,股东从公司获得的分红收入。 +客户资产,Client Assets,-,金融机构代表客户持有的各种资产。 +外汇市场,Foreign Exchange Market,Forex,买卖全球货币的市场。 +交易日,Trading Day,-,市场开放进行交易的工作日。 +财富管理,Wealth Management,WM,为富裕客户提供投资和财务规划建议的服务。 +信贷,Credit,-,借款人获得资金并同意在未来偿还的协议。 +融资,Financing,-,借款或融资以获得资金支持。 +黄金,Gold,-,贵重金属,常用作避险投资和商品。 +贸易赤字,Trade Deficit,-,进口货物价值大于出口货物价值的贸易情况。 \ No newline at end of file diff --git a/counit-server/Cargo.toml b/counit-server/Cargo.toml index 036910b..d151487 100644 --- a/counit-server/Cargo.toml +++ b/counit-server/Cargo.toml @@ -62,5 +62,8 @@ serde_json = "1.0.104" blake3 = "1.4.0" uuid = { version = "1.4.0", features = ["v4", "fast-rng", "serde"] } +#domain language +csv = "1.2" + [build-dependencies] fs_extra = "1.3.0" diff --git a/counit-server/src/configuration.rs b/counit-server/src/configuration.rs index 8241a5d..3730782 100644 --- a/counit-server/src/configuration.rs +++ b/counit-server/src/configuration.rs @@ -18,6 +18,10 @@ pub struct Configuration { #[serde(default = "default_model_dir")] /// Path to the embedding model directory pub model_dir: PathBuf, + + #[serde(default = "default_domain_language_dir")] + /// Path to the domain language directory, supported format: .csv, .json + pub domain_language_dir: Option, } const fn default_port() -> u16 { @@ -32,6 +36,10 @@ fn default_model_dir() -> PathBuf { "model".into() } +fn default_domain_language_dir() -> Option { + Some("domain".into()) +} + impl Configuration { pub fn default() -> Self { Configuration { @@ -42,6 +50,7 @@ impl Configuration { model_dir: Path::new(env!("CARGO_MANIFEST_DIR")).parent() .unwrap() .join("model"), + domain_language_dir: None, } } } diff --git a/counit-server/src/domain/domain_record.rs b/counit-server/src/domain/domain_record.rs new file mode 100644 index 0000000..241f1a3 --- /dev/null +++ b/counit-server/src/domain/domain_record.rs @@ -0,0 +1,7 @@ +#[derive(Debug, serde::Deserialize)] +pub struct DomainRecord { + native: String, + english: String, + abbreviation: String, + description: String, +} diff --git a/counit-server/src/domain/mod.rs b/counit-server/src/domain/mod.rs new file mode 100644 index 0000000..7a9cea7 --- /dev/null +++ b/counit-server/src/domain/mod.rs @@ -0,0 +1 @@ +pub mod domain_record; diff --git a/counit-server/src/main.rs b/counit-server/src/main.rs index 5095fc2..42a4118 100644 --- a/counit-server/src/main.rs +++ b/counit-server/src/main.rs @@ -17,6 +17,7 @@ pub mod application; pub mod configuration; pub mod agent; pub mod dsl; +pub mod domain; #[tokio::main] async fn main() -> anyhow::Result<()> {