provider=g4f.Provider.You
, смотреть активные провайдеры здесь.import g4f
response = g4f.ChatCompletion.create(
model=g4f.models.gpt_4,
messages=[{"role": "user", "content": "Hello"}],
provider=g4f.Provider.You,
stream=True,
)
for message in response:
print(message, flush=True, end="")
from g4f.client import Client
client = Client(
api_key="...",
...
)
function sendDiscordMessage() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var cell = sheet.getActiveCell();
var cellValue = cell.getValue();
var webhookUrl = 'https://discord.com/api/webhooks................................';
var payload = {
"content": 'content',
"embeds": [{
"title": 'title',
"description": "description",
"color": 16711680,
"image": {
"url": cellValue
}
}]
};
var options = {
"method": "POST",
"payload": JSON.stringify(payload),
"headers": {
"Content-Type": "application/json"
},
};
var response = UrlFetchApp.fetch(webhookUrl, options);
var status = response.getResponseCode();
if (status === 200 || status === 204) {
Logger.log("Discord message sent successfully.");
} else {
Logger.log("Failed to send Discord message. Status code: " + status);
}
}