Skip to content

Commit 1eabef0

Browse files
authored
Update app.py
1 parent 1892df8 commit 1eabef0

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

app.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from flask_restful import Api
1515
from flask_restful import Resource
1616

17-
openai.api_key = "__API__KEY__"
17+
openai.api_key = "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"
1818
model_engine = "text-davinci-003"
1919

2020
app = Flask(__name__)
@@ -82,16 +82,14 @@ def sanitize(input_string: str) -> str:
8282
return input_string
8383

8484

85-
def chunk_output(
86-
scan_output: str, max_token_size: int
87-
) -> list[dict[str, Any]]:
88-
scan_output_dict = json.loads(scan_output)
85+
def chunk_output(scan_output: dict,
86+
max_token_size: int) -> list[dict[str, Any]]:
8987
output_chunks = []
9088
current_chunk = {}
9189
current_token_count = 0
9290

9391
# Convert JSON to AI usable chunks
94-
for ip, scan_data in scan_output_dict.items():
92+
for ip, scan_data in scan_output.items():
9593
new_data_token_count = len(json.dumps({ip: scan_data}).split())
9694

9795
if current_token_count + new_data_token_count <= max_token_size:

0 commit comments

Comments
 (0)