This commit is contained in:
2025-05-04 08:19:47 +03:00
parent d8a59d0726
commit 46e1c6706c
177 changed files with 5708 additions and 5512 deletions

View File

@@ -5,25 +5,24 @@ module main
import freeflowuniverse.herolib.clients.openai
import os
fn test1(mut client openai.OpenAI)!{
instruction:='
fn test1(mut client openai.OpenAI) ! {
instruction := '
You are a template language converter. You convert Pug templates to Jet templates.
The target template language, Jet, is defined as follows:
'
// Create a chat completion request
res := client.chat_completion(msgs:openai.Messages{
messages: [
openai.Message{
role: .user
content: 'What are the key differences between Groq and other AI inference providers?'
},
]
})!
res := client.chat_completion(
msgs: openai.Messages{
messages: [
openai.Message{
role: .user
content: 'What are the key differences between Groq and other AI inference providers?'
},
]
}
)!
// Print the response
println('\nGroq AI Response:')
@@ -33,23 +32,21 @@ fn test1(mut client openai.OpenAI)!{
println('Prompt tokens: ${res.usage.prompt_tokens}')
println('Completion tokens: ${res.usage.completion_tokens}')
println('Total tokens: ${res.usage.total_tokens}')
}
fn test2(mut client openai.OpenAI)!{
fn test2(mut client openai.OpenAI) ! {
// Create a chat completion request
res := client.chat_completion(
model:"deepseek-r1-distill-llama-70b",
msgs:openai.Messages{
messages: [
openai.Message{
role: .user
content: 'A story of 10 lines?'
},
]
})!
model: 'deepseek-r1-distill-llama-70b'
msgs: openai.Messages{
messages: [
openai.Message{
role: .user
content: 'A story of 10 lines?'
},
]
}
)!
println('\nGroq AI Response:')
println('==================')
@@ -57,21 +54,18 @@ fn test2(mut client openai.OpenAI)!{
println('\nUsage Statistics:')
println('Prompt tokens: ${res.usage.prompt_tokens}')
println('Completion tokens: ${res.usage.completion_tokens}')
println('Total tokens: ${res.usage.total_tokens}')
println('Total tokens: ${res.usage.total_tokens}')
}
println('
println("
TO USE:
export AIKEY=\'gsk_...\'
export AIURL=\'https://api.groq.com/openai/v1\'
export AIMODEL=\'llama-3.3-70b-versatile\'
')
export AIKEY='gsk_...'
export AIURL='https://api.groq.com/openai/v1'
export AIMODEL='llama-3.3-70b-versatile'
")
mut client:=openai.get(name:"test")!
mut client := openai.get(name: 'test')!
println(client)
// test1(mut client)!
test2(mut client)!

View File

@@ -4,4 +4,4 @@ import freeflowuniverse.herolib.mcp.aitools
// aitools.convert_pug("/root/code/github/freeflowuniverse/herolauncher/pkg/herolauncher/web/templates/admin")!
aitools.convert_pug("/root/code/github/freeflowuniverse/herolauncher/pkg/zaz/webui/templates")!
aitools.convert_pug('/root/code/github/freeflowuniverse/herolauncher/pkg/zaz/webui/templates')!

View File

@@ -12,7 +12,7 @@ println('Starting Qdrant example script')
println('Current directory: ${os.getwd()}')
println('Home directory: ${os.home_dir()}')
mut i:=qdrant_installer.get()!
mut i := qdrant_installer.get()!
i.install()!
// 1. Get the qdrant client

View File

@@ -6,5 +6,3 @@ import freeflowuniverse.herolib.web.docusaurus
mut docs := docusaurus.new(
build_path: '/tmp/docusaurus_build'
)!

View File

@@ -90,14 +90,13 @@ fn main() {
'
mut docs := docusaurus.new(
build_path: os.join_path(os.home_dir(), 'hero/var/docusaurus_demo1')
update: true // Update the templates
heroscript: hero_script
build_path: os.join_path(os.home_dir(), 'hero/var/docusaurus_demo1')
update: true // Update the templates
heroscript: hero_script
) or {
eprintln('Error creating docusaurus factory with inline script: ${err}')
exit(1)
eprintln('Error creating docusaurus factory with inline script: ${err}')
exit(1)
}
// Create a site directory if it doesn't exist
site_path := os.join_path(os.home_dir(), 'hero/var/docusaurus_demo_src')
@@ -204,19 +203,19 @@ console.log(result);
eprintln('Error generating site: ${err}')
exit(1)
}
println('Site generated successfully!')
// Choose which operation to perform:
// Option 1: Run in development mode
// Option 1: Run in development mode
// This will start a development server in a screen session
println('Starting development server...')
site.dev() or {
eprintln('Error starting development server: ${err}')
exit(1)
}
// Option 2: Build for production (uncomment to use)
/*
println('Building site for production...')
@@ -236,4 +235,4 @@ console.log(result);
}
println('Site published successfully!')
*/
}
}