Skip to content

Improvement suggestion for constants for API and model usage #1

@DirtyHamster

Description

@DirtyHamster

I was messing around with your project the other day looking to try to run it locally. I noticed the server address is buried at the end of autoscript.rpy whereas the rest of the constants for API and model usage are listed clearly at the top of main.rpy. If you were to move the server address to be a constant listed in main.rpy it will make it more consistent and a little easier to run this locally if one chooses to do so.

If you don't make that change you can still append the instructions to show people, they can run this locally and to go look for the following lines to edit in autoscript.rpy (bottom of file):

data['messages'].extend([{'role': 'user', 'content': message} for message in self.conversation_history])
try:
response = requests.post('http://12.0.0.1:1234/v1/chat/completions', headers=headers, json=data)
response.raise_for_status()
return response.json()['choices'][0]['message']['content']
except requests.HTTPError as http_err:
print(f"HTTP error occurred: {http_err}")
self.conversation_history.pop()
narrator("An error occurred while communicating with the GPT model. Please try again.")
return ""
except Exception as err:
self.conversation_history.pop()
print(f"Other error occurred: {err}")
return ""

I tested it on LM studio but I'm fairly sure it would work with others too.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions