1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
用于**双向转换**安全数据表(SDS)文档(Word/PDF)与日本厚生劳动省(MHLW)标准JSON格式的GUI + CLI工具。
支持**日语、英语、简体中文、繁体中文**的SDS文档处理。
→ [全部版本与更新日志](https://github.com/kent-tokyo/sdsforge/releases)
无参数运行 `sdsforge` 即可启动图形界面:
```bash
sdsforge
```
将打开一个包含五个标签页的窗口(820×640):
将文件拖放至任意标签页可自动填充输入字段。
设置保存至操作系统配置目录下的 `sdsforge/config.toml`(macOS:
`~/Library/Application Support/sdsforge/config.toml`;Linux:
`~/.config/sdsforge/config.toml`)。若新配置文件尚不存在,首次启动本版本
时会自动从旧版 `sdsconv/config.toml` 迁移——已保存的API密钥和设置将保留,
旧文件不会被修改。
GUI与CLI共用相同的转换引擎(`tasks.rs`),转换结果完全一致。
```bash
export ANTHROPIC_API_KEY=sk-ant-...
sdsforge to-json --input input.pdf --output output.json
sdsforge to-json --input sds_en.pdf --output output.json --lang en
sdsforge to-json --input-dir ./pdfs/ --output-dir ./json/ --lang ja
sdsforge to-json --input input.pdf --output output.json \
--provider openai --api-key $OPENAI_API_KEY
sdsforge to-json --input input.pdf --output output.json \
--provider gemini --api-key $GEMINI_API_KEY
sdsforge to-json --input input.pdf --output output.json \
--provider local --base-url http://localhost:11434/v1 \
--model llama3.2 --api-key dummy
sdsforge to-json --input extracted.txt --output output.json --lang ja
```
**各提供商默认值:**
```bash
sdsforge render --input output.json --to docx --output result.docx --lang ja
sdsforge render --input-dir ./json/ --output-dir ./docx/ --to docx --lang en
sdsforge render --input output.json --to html --output result.html --lang ja
sdsforge render --input output.json --to pdf --output result.pdf --lang ja
sdsforge render --input output.json --to docx --output result.docx \
--template my_template.docx
sdsforge render --input-dir ./json/ --output-dir ./docx/ --to docx \
--template my_template.docx
```
`to-docx`、`to-html`、`to-pdf` 仍可作为 `render --to docx|html|pdf` 的弃用
别名使用(实现相同,会向stderr输出弃用警告)——请按自己的节奏迁移至
`render`。
在 `.docx` 文件中使用 `{{字段名}}` 占位符,`字段名` 为MHLW JSON模式中的叶节点键名。也支持完整的点路径形式。
```
{{TradeNameJP}} → 产品和名
{{CompanyName}} → 公司名称
{{Phone}} → 电话号码
{{IssueDate}} → 发行日期
{{Identification.SupplierInformation.CompanyName}} → 完整路径指定
```
占位符可出现在文档任意位置——段落、表格单元格、页眉和页脚均可。即使Word将文本分割为多个内部run,工具也会在替换前自动合并。
在不调用API的情况下提取LLM将接收的文本,用于检查提取质量或单独执行LLM步骤。
```bash
sdsforge extract-text --input input.pdf --output extracted.txt
sdsforge extract-text --input input.pdf
sdsforge to-json --input extracted.txt --output output.json --lang ja
```
```bash
sdsforge validate --input output.json
sdsforge validate --input output.json --json
```
检查关键节(Identification、HazardIdentification、ToxicologicalInformation等)是否已填充。发现问题时以退出码 `1` 退出。
- - - - - - - - -- - - - -
- -----------
- -
以下两种许可证任选其一:
- -