Skip to content

Commit 78e33c1

Browse files
committed
add convert script
1 parent 3669ef9 commit 78e33c1

File tree

3 files changed

+57
-11
lines changed

3 files changed

+57
-11
lines changed

Diff for: api_logic_server_cli/templates/opt_locking.txt

-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +0,0 @@
1-
@jsonapi_attr
2-
def _check_sum_(self): # type: ignore [no-redef]
3-
return None if isinstance(self, flask_sqlalchemy.model.DefaultMeta) \
4-
else self._check_sum_property if hasattr(self,"_check_sum_property") \
5-
else None # property does not exist during initialization
6-
7-
@_check_sum_.setter
8-
def _check_sum_(self, value): # type: ignore [no-redef]
9-
self._check_sum_property = value
10-
11-
replace_opt_locking_attr = _check_sum_

Diff for: nginx/wg.conf

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ server {
2020
index index.html index.htm;
2121
alias /home/api_logic_server/api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/;
2222
}
23+
24+
location /spa-dev/ {
25+
proxy_pass http://127.0.0.1:5173;
26+
proxy_set_header Host $host;
27+
proxy_set_header X-Real-IP $remote_addr;
28+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
29+
proxy_set_header X-Forwarded-Proto $scheme;
30+
}
2331
include /etc/nginx/apis/*.conf;
2432
include /opt/projects/wgadmin/nginx/*conf;
2533
}

Diff for: tests/genai_tests/logic_training/convert_to_jsonl.py

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# first arg: directory with *prompt , *response files
2+
3+
import json
4+
import sys
5+
from pathlib import Path
6+
import os
7+
8+
from pathlib import Path
9+
10+
def gen_jsonl(dir):
11+
# Define the directory path where you want to search for files
12+
directory_path = Path(dir)
13+
print(f'Using {directory_path}')
14+
15+
# Use the glob method to list files matching the pattern '*00.prompt'
16+
system_prompt_f = list(directory_path.glob('*00.response'))[0]
17+
lb_api_prompt_f = list(directory_path.glob('*01.prompt'))[0]
18+
user_prompt_f = list(directory_path.glob('*02.prompt'))[0]
19+
response_f = list(directory_path.glob('*03.response'))[0]
20+
21+
22+
with open(system_prompt_f) as f:
23+
system_prompt = f.read()
24+
25+
with open(lb_api_prompt_f) as f:
26+
prompt = f.read()
27+
28+
with open(lb_api_prompt_f) as f:
29+
prompt += f.read()
30+
31+
with open(response_f) as f:
32+
response = f.read()
33+
34+
35+
jsonline = {
36+
"messages":
37+
[
38+
{"role": "system", "content": system_prompt},
39+
{"role": "user", "content": prompt},
40+
{"role": "assistant", "content": response}
41+
]
42+
}
43+
44+
with open('ft.jsonl', 'a+') as f:
45+
json.dump(jsonline, f)
46+
f.write('\n')
47+
48+
49+
gen_jsonl(sys.argv[1])

0 commit comments

Comments
 (0)