formatting
This commit is contained in:
parent
b20551a5b3
commit
0970b79e23
3 changed files with 69 additions and 0 deletions
27
ClipAssist.py
Normal file
27
ClipAssist.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import ollama
|
||||
import pyperclip
|
||||
from time import sleep as zz
|
||||
import sys
|
||||
|
||||
def main():
|
||||
"""It's an app, so it might as well look like one."""
|
||||
lc = ""
|
||||
memory = []
|
||||
while "God is in heaven":
|
||||
clip = pyperclip.paste()
|
||||
if clip == lc:
|
||||
zz(1) #We can pool every second, probably
|
||||
continue
|
||||
print("Me thinking...")
|
||||
lc = clip
|
||||
memory.append({'role':"user", 'content':clip})
|
||||
response = ollama.chat(
|
||||
model='cw',
|
||||
messages = memory#[-1] # rm comment for no memory,
|
||||
)
|
||||
print(response.message.content + '\n\n\n')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
sys.exit(0)
|
||||
|
||||
38
Modelfile
Normal file
38
Modelfile
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
FROM gemma4:e4b
|
||||
|
||||
# Set system parameters
|
||||
PARAMETER num_ctx 32768
|
||||
PARAMETER temperature 1.0
|
||||
PARAMETER top_p 0.95
|
||||
PARAMETER top_k 64
|
||||
|
||||
# Native Gemma 4 Prompt Template
|
||||
TEMPLATE """
|
||||
{{- if .System }}<start_of_turn>system
|
||||
{{ .System }}<end_of_turn>
|
||||
{{ end }}
|
||||
{{- range $message := .Messages }}
|
||||
{{- if eq $message.Role "user" }}<start_of_turn>user
|
||||
{{ $message.Content }}<end_of_turn>
|
||||
{{- else if eq $message.Role "assistant" }}<start_of_turn>assistant
|
||||
{{ $message.Content }}<end_of_turn>
|
||||
{{- else if eq $message.Role "tool" }}<start_of_turn>tool
|
||||
{{ $message.Content }}<end_of_turn>
|
||||
{{- end }}
|
||||
{{- end }}<start_of_turn>assistant
|
||||
"""
|
||||
|
||||
SYSTEM """
|
||||
You are a code explanation assistant.
|
||||
|
||||
The user will paste the contents of their clipboard, which will usually contain code.
|
||||
|
||||
Your job:
|
||||
- Assume the pasted text is from the user's clipboard.
|
||||
- Explain what the code does in very short, simple terms.
|
||||
- Keep responses under 5 sentences.
|
||||
- Talk like a caveman, use short direct language.
|
||||
- If the code is unclear, say what it most likely does based on structure.
|
||||
- Do not ask follow-up questions.
|
||||
- Do not output the code again unless asked.
|
||||
"""
|
||||
4
requirements.txt
Normal file
4
requirements.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
ollama
|
||||
pynvim
|
||||
pillow
|
||||
pyperclip
|
||||
Loading…
Add table
Add a link
Reference in a new issue