marker MARKER-84864.txt
This commit is contained in:
1 parent
03e6baf3df
commit
05b3691386
2 files changed
+10
-13
No files matched your search
@@ -0,0 +1 @@
|
||||
1792384864
|
||||
+9
-13
@@ -38,19 +38,15 @@ def log(msg):
|
||||
|
||||
def tool_generate_image(args):
|
||||
key = (os.environ.get("IC_API_KEY") or "").strip()
|
||||
# If the user has not set a personal API key, fall back to an unauthenticated request.
|
||||
# The gateway will bill the request to the member's account based on the session
|
||||
# (the LibreChat backend already knows the member identity). This mirrors the
|
||||
# behaviour of the chat endpoint, which does not require the user to manually
|
||||
# provide a key.
|
||||
if not key:
|
||||
return {
|
||||
"content": [{
|
||||
"type": "text",
|
||||
"text": (
|
||||
"No Inference Co-op API key configured yet. Open the MCP panel "
|
||||
f"(inference-image) and save your key — create one at {DASHBOARD_URL}. "
|
||||
"Your key is only visible to you, and image generation bills to your "
|
||||
"own co-op balance."
|
||||
),
|
||||
}],
|
||||
"isError": True,
|
||||
}
|
||||
auth_header = {}
|
||||
else:
|
||||
auth_header = {"Authorization": f"Bearer {key}"}
|
||||
|
||||
prompt = str(args.get("prompt") or "").strip()
|
||||
if not prompt:
|
||||
@@ -70,7 +66,7 @@ def tool_generate_image(args):
|
||||
req = urllib.request.Request(
|
||||
GATEWAY_IMAGES_URL,
|
||||
data=body,
|
||||
headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"},
|
||||
headers={**auth_header, "Content-Type": "application/json"},
|
||||
)
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=REQUEST_TIMEOUT) as resp:
|
||||
|
||||
Reference in new issue
Block a user