variety of changes: custom system prompt, some bugs, dev qol
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
name: CI Test Guard
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
validate-code:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Set up Node.js (For JS Validation)
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install Python Linters
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8
|
||||
|
||||
- name: Python Syntax Check
|
||||
run: python -m py_compile ai_answers.py
|
||||
|
||||
- name: Python Undefined Variable Check
|
||||
run: flake8 ai_answers.py --select=E9,F63,F7,F82 --show-source
|
||||
|
||||
- name: JavaScript Extraction & Syntax Check
|
||||
run: |
|
||||
python -c '
|
||||
import re, sys
|
||||
with open("ai_answers.py", "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
match = re.search(r"FRONTEND_JS_TEMPLATE\s*=\s*r\"\"\"(.*?)\"\"\"", content, re.DOTALL)
|
||||
if not match:
|
||||
print("Could not find FRONTEND_JS_TEMPLATE")
|
||||
sys.exit(1)
|
||||
|
||||
js_code = match.group(1)
|
||||
|
||||
replacements = {
|
||||
"__IS_INTERACTIVE__": "true",
|
||||
"__JS_Q__": "\"dummy_query\"",
|
||||
"__JS_LANG__": "\"en\"",
|
||||
"__JS_URLS__": "[]",
|
||||
"__B64_CONTEXT__": "\"YmFzZTY0\"",
|
||||
"__TK__": "\"dummy_token\"",
|
||||
"__SCRIPT_ROOT__": "\"/searxng\"",
|
||||
"__CITATION_HELPER_JS__": "/* citation helper */",
|
||||
"__INTERACTIVE_JS_INIT__": "/* init */",
|
||||
"__STREAM_FN_SIG__": "async function startStream(overrideQ = null, prevAnswer = null, auxContext = null)",
|
||||
"__STREAM_Q__": "\"dummy_q\"",
|
||||
"__STREAM_BODY__": "",
|
||||
"__INTERACTIVE_JS_COMPLETE__": "/* complete */"
|
||||
}
|
||||
|
||||
for key, val in replacements.items():
|
||||
js_code = js_code.replace(key, val)
|
||||
|
||||
with open("frontend_test.js", "w", encoding="utf-8") as f:
|
||||
f.write(js_code)
|
||||
'
|
||||
|
||||
node --check frontend_test.js
|
||||
Reference in New Issue
Block a user