@@ -27,28 +27,31 @@ def main(vrn, d):
2727
2828def gen_log (prompt ):
2929
30- log = None
3130 auth = os .environ .get ('LLM_JWT' )
32- headers = {"Content-Type" : "application/json" , "Authorization" : f"Bearer { auth } " }
33- payload = {
34- "model" : "us.anthropic.claude-3-5-sonnet-20241022-v2:0" ,
35- "messages" : [
36- {
37- "role" : "user" ,
38- "content" : prompt
39- }
40- ]
41- }
42-
43- try :
44- r = requests .post ('https://openwebui.dev.devrev-eng.ai/api/chat/completions' , json = payload ,
45- headers = headers )
46- log = r .json ()['choices' ][0 ]['message' ]['content' ]
47- log = re .sub (r"^Here's.*\n?" , '' , log , flags = re .MULTILINE )
48- log = re .sub (r"^Let me know.*\n?" , '' , log , flags = re .MULTILINE )
49- except Exception as e :
50- print (
51- f"Failed to generate changelog. Error: { type (e )} { e } { r } " )
31+ if auth :
32+ headers = {"Content-Type" : "application/json" , "Authorization" : f"Bearer { auth } " }
33+ payload = {
34+ "model" : "us.anthropic.claude-3-5-sonnet-20241022-v2:0" ,
35+ "messages" : [
36+ {
37+ "role" : "user" ,
38+ "content" : prompt
39+ }
40+ ]
41+ }
42+
43+ try :
44+ r = requests .post ('https://openwebui.dev.devrev-eng.ai/api/chat/completions' , json = payload ,
45+ headers = headers )
46+ log = r .json ()['choices' ][0 ]['message' ]['content' ]
47+ log = re .sub (r"^Here's.*\n?" , '' , log , flags = re .MULTILINE )
48+ log = re .sub (r"^Let me know.*\n?" , '' , log , flags = re .MULTILINE )
49+ except Exception as e :
50+ print (
51+ f"Failed to generate changelog. Error: { type (e )} { e } { r } " )
52+ else :
53+ log = "No auth token"
54+
5255 return log
5356
5457
0 commit comments