server: reset digest at end of generate

This commit is contained in:
Jeffrey Morgan 2023-08-02 16:15:40 -04:00
parent cc509a994e
commit 03cff3a225

View file

@ -31,8 +31,8 @@ var loaded struct {
expireAt time.Time expireAt time.Time
expireTimer *time.Timer expireTimer *time.Timer
digest string digest string
options api.Options options api.Options
} }
func GenerateHandler(c *gin.Context) { func GenerateHandler(c *gin.Context) {
@ -57,6 +57,7 @@ func GenerateHandler(c *gin.Context) {
if loaded.llm != nil { if loaded.llm != nil {
loaded.llm.Close() loaded.llm.Close()
loaded.llm = nil loaded.llm = nil
loaded.digest = ""
} }
opts := api.DefaultOptions() opts := api.DefaultOptions()
@ -98,6 +99,7 @@ func GenerateHandler(c *gin.Context) {
loaded.llm.Close() loaded.llm.Close()
loaded.llm = nil loaded.llm = nil
loaded.digest = ""
}) })
} }
loaded.expireTimer.Reset(sessionDuration) loaded.expireTimer.Reset(sessionDuration)