gpt trial, more style, less deps

This commit is contained in:
Pascal Engélibert 2023-04-01 00:40:54 +02:00
parent 562443d86d
commit 6ef6af9b58
3 changed files with 31 additions and 61 deletions

58
Cargo.lock generated
View file

@ -1004,16 +1004,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd550e73688e6d578f0ac2119e32b797a327631a42f9433e59d02e139c8df60d" checksum = "cd550e73688e6d578f0ac2119e32b797a327631a42f9433e59d02e139c8df60d"
[[package]]
name = "lock_api"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.17" version = "0.4.17"
@ -1161,29 +1151,6 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
dependencies = [
"cfg-if",
"libc",
"redox_syscall 0.2.16",
"smallvec",
"windows-sys 0.45.0",
]
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.2.0" version = "2.2.0"
@ -1362,15 +1329,6 @@ dependencies = [
"rand_core 0.5.1", "rand_core 0.5.1",
] ]
[[package]]
name = "redox_syscall"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.3.5" version = "0.3.5"
@ -1463,12 +1421,6 @@ dependencies = [
"windows-sys 0.42.0", "windows-sys 0.42.0",
] ]
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "security-framework" name = "security-framework"
version = "2.8.2" version = "2.8.2"
@ -1635,12 +1587,6 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "smallvec"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.4.9" version = "0.4.9"
@ -1754,7 +1700,7 @@ checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand", "fastrand",
"redox_syscall 0.3.5", "redox_syscall",
"rustix", "rustix",
"windows-sys 0.45.0", "windows-sys 0.45.0",
] ]
@ -1865,9 +1811,7 @@ dependencies = [
"libc", "libc",
"mio", "mio",
"num_cpus", "num_cpus",
"parking_lot",
"pin-project-lite 0.2.9", "pin-project-lite 0.2.9",
"signal-hook-registry",
"socket2", "socket2",
"tokio-macros", "tokio-macros",
"windows-sys 0.45.0", "windows-sys 0.45.0",

View file

@ -11,7 +11,7 @@ percent-encoding = "2.2.0"
rand = "0.8.5" rand = "0.8.5"
reqwest = { version = "0.11.16", features = ["blocking", "brotli", "deflate", "gzip"] } reqwest = { version = "0.11.16", features = ["blocking", "brotli", "deflate", "gzip"] }
tide = { version = "0.16.0", default-features = false, features = ["h1-server", "logger"] } tide = { version = "0.16.0", default-features = false, features = ["h1-server", "logger"] }
tokio = { version = "1.27.0", features = ["full"] } tokio = { version = "1.27.0", features = ["macros", "rt", "rt-multi-thread"] }
#roxmltree = { version = "0.18.0", default-features = false, features = ["std"] } #roxmltree = { version = "0.18.0", default-features = false, features = ["std"] }
#rxml = "0.9.1" #rxml = "0.9.1"
#rxml = { path = "/home/tuxmain/Téléchargements/rxml/rxml" } #rxml = { path = "/home/tuxmain/Téléchargements/rxml/rxml" }

View file

@ -172,6 +172,7 @@ async fn handle_request<'a>(_req: tide::Request<()>) -> tide::Result<tide::Respo
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>MLeTomatic</title> <title>MLeTomatic</title>
<!--<script type="text/javascript" src="//txmn.tk/js/jquery.js"></script>-->
<style type="text/css"> <style type="text/css">
@font-face {{ @font-face {{
font-family: CustomFont; font-family: CustomFont;
@ -180,7 +181,7 @@ async fn handle_request<'a>(_req: tide::Request<()>) -> tide::Result<tide::Respo
body {{ body {{
text-align: center; text-align: center;
}} }}
h1 {{ h1, #pitch {{
font-family: CustomFont; font-family: CustomFont;
font-weight: normal; font-weight: normal;
}} }}
@ -192,11 +193,36 @@ h1 {{
</head> </head>
<body> <body>
<h1>Monnaie Libre et {word}</h1> <h1>Monnaie Libre et {word}</h1>
<!--<p id="pitch"><noscript>Active JavaScript pour découvrir pourquoi tu devrais rejoindre l'association Monnaie Libre et {word}&#8239;!</noscript></p>-->
<img id="img" alt="{word}" src="{img_url}"/> <img id="img" alt="{word}" src="{img_url}"/>
<div id="info"> <div id="info">
<a href="https://git.txmn.tk/tuxmain/MLeTomatic">MLeTomatic</a> &#8211; <p><a href="https://git.txmn.tk/tuxmain/MLeTomatic">MLeTomatic</a>, parce qu'on ne fait pas d'mlet sans casser des nœuds &#8211; Images trouvées par Bing, soumises au droit d'auteur. Mots tirés de Lefff, lire la licence dans le dépôt.</p>
<span>Images trouvées par Bing, soumises au droit d'auteur. Mots tirés de Lefff, lire la licence dans le dépôt.</span>
</div> </div>
<script type="text/javascript">
/*window.onload = function() {{
$.ajax({{
method: "POST",
url: "https://api.openai.com/v1/engines/text-davinci-003/completions",
data: JSON.stringify({{
"prompt":"Rédige un court flyer pour l'association \"Monnaie Libre et {word}\", en accentuant l'aspect \"{word}\".",
"max_tokens":250,
"temperature":1,
"top_p":1,
"n":1,
"stream":false,
"echo":false,
"presence_penalty":0,
"frequency_penalty":0,
"best_of":1
}}),
success: function(resp) {{
document.getElementById("pitch").innerHTML = resp.choices[0].text;
}},
dataType: "json",
contentType: "application/json; charset=utf-8"
}});
}};*/
</script>
</body> </body>
</html>"#)) </html>"#))
.build()) .build())