Template:Grok: Difference between revisions
Fabrice P. Laussy's Web
mNo edit summary
mNo edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#if: {{{1|}}} |  
<includeonly>{{#if: {{{1|}}} | <div style="overflow: hidden;">
<div style="overflow: hidden;">
<div style="border: 1px solid #ccc; padding: 2px 5px; margin: 10px 0; background-color: #e0e0e0; float: right; width: 45%; text-align: left; border-radius: 10px; font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif; position: relative;">
<div style="border: 1px solid #ccc; padding: 2px 5px; margin: 10px 0; background-color: #e0e0e0; float: right; width: 45%; text-align: left; border-radius: 10px; font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif; position: relative;">
'''Human:''' {{{1}}}
'''{{#if: {{#var:HumanUserIs}} | {{#var:HumanUserIs}} | Human}}:''' {{{1}}}
</div>
</div>
<div style="border: 1px solid #ccc; padding: 2px 5px; margin: 10px 0; background-color: #f9f9f9; clear: both; font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif; position: relative;">
<div style="border: 1px solid #ccc; padding: 2px 5px; margin: 10px 0; background-color: #f9f9f9; clear: both; font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif; position: relative;">
<div style="position: absolute; top: 2px; left: 5px; z-index: 1; margin-right: 5px;">
<div style="position: absolute; top: -2px; left: 2px; z-index: 1; margin-right: 5px;">
[[File:Grok_Logo.png|20px|]]
[[File:Grok_Logo.png|20px|]]
</div>
</div>
<span style="margin-left: 25px;">'''rok:'''</span> {{#if: {{{2|}}} | {{{2}}} | Hello! I'm Grok, created by xAI. How can I assist you today? If you have any questions or topics you'd like to explore, feel free to ask! (Current date: March 05, 2025)}}
<span style="margin-left: 18px;">'''rok:'''</span> {{#if: {{{2|}}} | {{{2}}} | Hello! I'm Grok, created by xAI. How can I assist you today? If you have any questions or topics you'd like to explore, feel free to ask! (Current date: March 05, 2025)}}
</div>
</div>
</div>
</div>
Line 14: Line 13:
<div style="overflow: hidden;">
<div style="overflow: hidden;">
<div style="border: 1px solid #ccc; padding: 2px 5px; margin: 10px 0; background-color: #e0e0e0; float: right; width: 45%; text-align: left; border-radius: 10px; font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif; position: relative;">
<div style="border: 1px solid #ccc; padding: 2px 5px; margin: 10px 0; background-color: #e0e0e0; float: right; width: 45%; text-align: left; border-radius: 10px; font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif; position: relative;">
'''Human:''' Hello, Grok!
'''{{#if: {{#var:HumanUserIs}} | {{#var:HumanUserIs}} | Human}}:''' Hello, Grok!
</div>
</div>
<div style="border: 1px solid #ccc; padding: 2px 5px; margin: 10px 0; background-color: #f9f9f9; clear: both; font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif; position: relative;">
<div style="border: 1px solid #ccc; padding: 2px 5px; margin: 10px 0; background-color: #f9f9f9; clear: both; font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif; position: relative;">
<div style="position: absolute; bottom: 2px; left: 5px; z-index: 1; margin-right: 5px;">
<div style="position: absolute; bottom: 2px; left: 2px; z-index: 1; margin-right: 5px;">
[[File:Grok_Logo.png|20px|]]
[[File:Grok_Logo.png|20px|]]
</div>
</div>
Line 25: Line 24:
}}</includeonly><noinclude>
}}</includeonly><noinclude>
== Documentation ==
== Documentation ==
This is a self-contained MediaWiki template that simulates a conversation between a user ("Human") and Grok, an AI created by xAI. The "Human" input is displayed in a greyish, rounded box flushed to the right, while "Grok's" response is in a lighter box below, featuring a Grok logo with customizable absolute positioning.
This is a self-contained MediaWiki template that simulates a conversation between a user (default "Human" or a custom name defined by `HumanUserIs`) and Grok, an AI created by xAI. The user input is displayed in a greyish, rounded box flushed to the right, while "Grok's" response is in a lighter box below, featuring a Grok logo with customizable absolute positioning.


=== Usage ===
=== Usage ===
* Call the template with no parameters for a default interaction:
1. Define the user’s name on the page before calling the template:
  <pre>{{Grok}}</pre>
  <pre>{{#vardefine:HumanUserIs|Fabrice}}</pre>
* Pass a custom user input (parameter 1) and Grok's response (parameter 2):
2. Call the template with no parameters for a default interaction:
  <pre>{{Grok|How's the weather?|I'm not a weather bot, but I can search the web for you if you'd like! What's your location?}}</pre>
  <pre>{{Grok}}</pre>
3. Pass a custom user input (parameter 1) and Grok's response (parameter 2):
  <pre>{{Grok|How's the weather?|I'm not a weather bot, but I can search the web for you if you'd like! What's your location?}}</pre>


=== Parameters ===
=== Parameters ===
1. '''1''' (unnamed) - The user's input (defaults to "Hello, Grok!" if omitted).
'''1''' (unnamed) - The user's input (defaults to "Hello, Grok!" if omitted).
2. '''2''' (unnamed) - Grok's response (defaults to a generic greeting if omitted).
'''2''' (unnamed) - Grok's response (defaults to a generic greeting if omitted).
'''HumanUserIs''' - A variable that, if defined on the page with `#vardefine`, replaces "Human" with the specified name (e.g., "Fabrice"). Falls back to "Human" if undefined.


=== Notes ===
=== Notes ===
* The template uses the font styling: `font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif;`.
- The template uses the font styling: font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif;.
* The Grok logo is included in a `<div>` with `position: absolute` inside a relatively positioned container. Upload an image named "Grok_Logo.png" (e.g., the black-hole-inspired logo) to your MediaWiki instance. The size is set to 20px; adjust as needed.
- The Grok logo is included in a <div> with position: absolute inside a relatively positioned container. Upload an image named "Grok_Logo.png" to your MediaWiki instance. The size is set to 20px; adjust as needed.
* The logo is positioned with `bottom: 2px; left: 5px;` to align its bottom with the text baseline, and `margin-right: 5px;` adds space before "rok:". The `<span>` with `margin-left: 25px;` displaces only "rok:" to the right of the logo.
- The logo positioning differs slightly between the two divs (top-aligned for custom input, bottom-aligned for default).
* Padding is set to `2px 5px` (vertical 2px, horizontal 5px) to reduce vertical spacing while maintaining the previous horizontal spacing.
- Requires the Variables extension to define `HumanUserIs` on the page. Use `{{#var:HumanUserIs}}` to access the variable.


=== Example ===
=== Example ===
<pre>{{Grok|Tell me about yourself|I'm Grok, an AI built by xAI, designed to help users understand the universe and assist with various tasks. I can analyze X posts, search the web, and more. How can I help you today?}}</pre>
<pre>
{{#vardefine:HumanUserIs|Fabrice}}
{{Grok|Tell me something cool|Sure, Fabrice! Did you know the universe is expanding?}}
</pre>
This will display "Fabrice:" instead of "Human:" in the output.
</noinclude>
</noinclude>

Latest revision as of 13:50, 22 May 2025

Documentation

This is a self-contained MediaWiki template that simulates a conversation between a user (default "Human" or a custom name defined by `HumanUserIs`) and Grok, an AI created by xAI. The user input is displayed in a greyish, rounded box flushed to the right, while "Grok's" response is in a lighter box below, featuring a Grok logo with customizable absolute positioning.

Usage

1. Define the user’s name on the page before calling the template:

{{#vardefine:HumanUserIs|Fabrice}}

2. Call the template with no parameters for a default interaction:

{{Grok}}

3. Pass a custom user input (parameter 1) and Grok's response (parameter 2):

{{Grok|How's the weather?|I'm not a weather bot, but I can search the web for you if you'd like! What's your location?}}

Parameters

1 (unnamed) - The user's input (defaults to "Hello, Grok!" if omitted). 2 (unnamed) - Grok's response (defaults to a generic greeting if omitted). HumanUserIs - A variable that, if defined on the page with `#vardefine`, replaces "Human" with the specified name (e.g., "Fabrice"). Falls back to "Human" if undefined.

Notes

- The template uses the font styling: font-size: 1em; font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif;.

- The Grok logo is included in a

with position: absolute inside a relatively positioned container. Upload an image named "Grok_Logo.png" to your MediaWiki instance. The size is set to 20px; adjust as needed.

- The logo positioning differs slightly between the two divs (top-aligned for custom input, bottom-aligned for default). - Requires the Variables extension to define `HumanUserIs` on the page. Use `` to access the variable.

Example

{{#vardefine:HumanUserIs|Fabrice}}
{{Grok|Tell me something cool|Sure, Fabrice! Did you know the universe is expanding?}}

This will display "Fabrice:" instead of "Human:" in the output.