Frobenius manifolds in critical and non-critical strings