vsegpt
Browse files
app.py
CHANGED
@@ -73,14 +73,27 @@ def load_assets():
|
|
73 |
return tool
|
74 |
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
def generate_gpt_comment(piece_or_text, message, context):
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
{"role": "user", "content": prompt.format(piece_or_text, message, context)}
|
81 |
-
]
|
82 |
)
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
|
86 |
def check_text(text, tool):
|
|
|
73 |
return tool
|
74 |
|
75 |
|
76 |
+
# def generate_gpt_comment(piece_or_text, message, context):
|
77 |
+
# response = openai.ChatCompletion.create(
|
78 |
+
# model="gpt-4o-mini",
|
79 |
+
# messages=[
|
80 |
+
# {"role": "user", "content": prompt.format(piece_or_text, message, context)}
|
81 |
+
# ]
|
82 |
+
# )
|
83 |
+
# return response.choices[0].message['content']
|
84 |
+
|
85 |
+
|
86 |
def generate_gpt_comment(piece_or_text, message, context):
|
87 |
+
client = openai.OpenAI(
|
88 |
+
api_key='sk-or-vv-44ca318747a45e810149bf769e9dfbe5f42046695875efd7c9121cca590d6906',
|
89 |
+
base_url='https://api.vsegpt.ru/v1'
|
|
|
|
|
90 |
)
|
91 |
+
response = client.chat.completions.create(
|
92 |
+
model="gpt-4o-mini",
|
93 |
+
messages=[{"role": "user", "content": prompt.format(piece_or_text, message, context)}]
|
94 |
+
).choices[0].message.content
|
95 |
+
|
96 |
+
return response
|
97 |
|
98 |
|
99 |
def check_text(text, tool):
|