Mercurial Hosting > reactionary
comparison src/lib/Shared.luan @ 95:83d98c822c71
ai change
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Fri, 16 May 2025 17:24:47 -0600 |
| parents | 7a56c17befab |
| children | 828bbbeff627 |
comparison
equal
deleted
inserted
replaced
| 94:8185a3eefe0c | 95:83d98c822c71 |
|---|---|
| 1 local ai = "gpt" | |
| 2 | |
| 1 local Luan = require "luan:Luan.luan" | 3 local Luan = require "luan:Luan.luan" |
| 2 local error = Luan.error | 4 local error = Luan.error |
| 3 local ipairs = Luan.ipairs or error() | 5 local ipairs = Luan.ipairs or error() |
| 4 local pairs = Luan.pairs or error() | 6 local pairs = Luan.pairs or error() |
| 5 local Time = require "luan:Time.luan" | 7 local Time = require "luan:Time.luan" |
| 6 local Http = require "luan:http/Http.luan" | 8 local Http = require "luan:http/Http.luan" |
| 7 local Translator = require "luan:gpt/Translator.luan" | 9 local Ai = require "luan:ai/Ai.luan" |
| 8 local Site_translator = require "luan:gpt/Site_translator.luan" | 10 Ai.set_ai(ai) |
| 11 local require_ai = Ai.require_ai or error() | |
| 12 local Translator = require_ai "Translator.luan" | |
| 13 local Site_translator = require "luan:ai/Site_translator.luan" | |
| 9 local get_lang = Site_translator.get_lang or error() | 14 local get_lang = Site_translator.get_lang or error() |
| 10 local languages = Site_translator.languages or error() | 15 local languages = Site_translator.languages or error() |
| 11 | 16 |
| 12 | 17 |
| 13 local Shared = {} | 18 local Shared = {} |
| 14 | 19 |
| 15 function Translator.prompt(html,language) | 20 if ai == "gpt" then |
| 21 function Translator.prompt(html,language) | |
| 16 %> | 22 %> |
| 17 Please translate the HTML below delimited by triple quotes from English to <%=language%>. | 23 Please translate the HTML below delimited by triple quotes from English to <%=language%>. |
| 18 | 24 |
| 19 Note that the content is related to computer programming, so keep that in mind while translating. The English word "library" refers to a programming library, not a place to borrow books, so translate to the word in the target language that means programming library. So for Spanish, use "librerÃa". | 25 Note that the content is related to computer programming, so keep that in mind while translating. The English word "library" refers to a programming library, not a place to borrow books, so translate to the word in the target language that means programming library. So for Spanish, use "librerÃa". |
| 20 | 26 |
| 24 | 30 |
| 25 """ | 31 """ |
| 26 <%=html%> | 32 <%=html%> |
| 27 """ | 33 """ |
| 28 <% | 34 <% |
| 29 end | 35 end |
| 36 else error(ai) end | |
| 30 | 37 |
| 31 Http.not_found_handler = Site_translator.not_found_handler or error() | 38 Http.not_found_handler = Site_translator.not_found_handler or error() |
| 32 | 39 |
| 33 local started = Time.now() | 40 local started = Time.now() |
| 34 | 41 |
